My.Computer.FileSystem.GetName Method
Parses the file name out of the path provided.
' Usage
Dim value As String = My.Computer.FileSystem.GetFileName(path)
' Declaration
Public Function GetFileName( _
ByVal path As String _
) As String
Parameters
- path
Required. Path to be parsed. String.
Return Value
String.
Exceptions
This method throws no exceptions.
Remarks
This is a string operation; the FileSystem is not examined.
The GetName method ignores a slash mark occurring at the end of the path.
Tasks
The following table lists examples of tasks involving the My.Computer.FileSystem.GetFileName method.
To |
See |
---|---|
Parse a file path |
Example
The following example parses a file path and returns the name of the file.
MsgBox("The filename is: " & _
My.Computer.FileSystem.GetName("C:\testdirectory\testfile"))
Replace the path C:\Testdirectory\Testfile with the path you wish to parse.
Requirements
Namespace:Microsoft.VisualBasic.MyServices
Class:FileSystemProxy (provides access to FileSystem)
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Availability by Project Type
Project type |
Available |
---|---|
Windows Application |
Yes |
Class Library |
Yes |
Console Application |
Yes |
Windows Control Library |
Yes |
Web Control Library |
Yes |
Windows Service |
Yes |
Web Site |
Yes |
Permissions
No permissions are required.