I need the code to trim this path to just get the filename
Example: "C:\My Documents\Book.doc"
How do i return just "Book.doc"
An answer or code would be appreciated.
Thank you
I need the code to trim this path to just get the filename
Example: "C:\My Documents\Book.doc"
How do i return just "Book.doc"
An answer or code would be appreciated.
Thank you
HELP! ~ How do I Trim a Path?
xRuntime
System.IO.Path Class
http://msdn2.microsoft.com/en-us/library/system.io.path.aspx
Great examples of this class in use doing just what you want.
http://www.extremeexperts.com/Net/CodeSnippets/Pathclass.aspx
Nick Waanders
You can use something like this
Dim
getmemyfile As String = My.Computer.FileSystem.GetName("d:\my documents\myfile.txt") orDim
getmemyfile As IO.FileInfo = My.Computer.FileSystem.GetFileInfo("d:\my documents\myfile.txt")TextBox1.Text = getmemyfile.Name
Janxels
perfect sample, that's what I was looking for.
I use it in my project like this:
Dim
myFile As StringIf
OpenFileAttach.ShowDialog = Windows.Forms.DialogResult.OK ThenmyFile =
My.Computer.FileSystem.GetName(OpenFileAttach.FileName.ToString) Me.StatusLabel.Text = "Open file: " & myFile End If