Skip to Main Content
Visual Basic 2015 Unleashed
book

Visual Basic 2015 Unleashed

by Alessandro Del Sole
July 2015
Intermediate to advanced content levelIntermediate to advanced
1300 pages
87h 27m
English
Sams
Content preview from Visual Basic 2015 Unleashed

The System.IO.Path Class

Often you need to work with pathnames, directory names, and filenames. The .NET Framework provides the System.IO.Path class, offering shared members that enable you to manipulate pathnames. For example, you might want to extract the filename from a pathname. This is accomplished by invoking the GetFileName method as follows:

'Returns "TextFile.txt"Dim fileName As String = Path.GetFileName("C:\TextFile.txt")

The GetExtension method returns instead only the file extension and is used as follows:

'Returns ".txt"Dim extension As String = Path.GetExtension("C:\TextFile.txt")

To ensure that a filename has an extension, you can also invoke the HasExtension method that ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Visual Basic 2015

Beginning Visual Basic 2015

Bryan Newsome

Publisher Resources

ISBN: 9780134196664Purchase book