Get filename without the path - Beginner in VB

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hi

I have a filedialog that returns the entire path and the filename of a given
file.
How can I remove the filepath from the filename property and only have the
basic filename.
Say I have a file test.txt located in c:\users\username, then the
filedialog.filename property returns "c:\users\username\test.txt".
What I need is a way to remove "C:\users\username" and only have the
test.txt entry.

It is probably an easy task, but I can't see it.

/A.
 
Andy said:
Hi

I have a filedialog that returns the entire path and the filename of a
given file.
How can I remove the filepath from the filename property and only have the
basic filename.
Say I have a file test.txt located in c:\users\username, then the
filedialog.filename property returns "c:\users\username\test.txt".
What I need is a way to remove "C:\users\username" and only have the
test.txt entry.

It is probably an easy task, but I can't see it.

/A.
System.IO.Path.GetFileName("c:\users\username\test.txt")
 
Back
Top