Export (0) Print
Expand All
Expand Minimize

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.

String.

This method throws no exceptions.

This is a string operation; the FileSystem is not examined.

The GetName method ignores a slash mark occurring at the end of the path.

The following table lists examples of tasks involving the My.Computer.FileSystem.GetFileName method.

To See

Parse a file path

How to: Parse File Paths in Visual Basic

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.

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

No permissions are required.

Community Additions

ADD
Show:
© 2014 Microsoft