Extract and get/retrieve the Filename only from a path – VB.NET
Monday, September 24th, 2007One Way to do It ' 'This will extract and return the filename from the specified path and filename. ' Dim filePath As String = "c:\MyDirectory\MYFile.txt" Dim slashPosition As Integer = filePath.LastIndexOf("\") Dim filenameOnly As String = filePAth.Substring(slashPosition + 1) MsgBox(filenameOnly) Second Way to do It ' 'Thanks to Jim for [...]
