Link to home
Start Free TrialLog in
Avatar of rwallacej
rwallacej

asked on

OpenFileDialog - get filename

I'd like to get only the filename that user selected in openfiledialog not the full file name (that OpenFileDialog1.FileName gives) i.e.

return "myfile.txt" instead of "C:\a directory\myfile.txt"

Thanks
ASKER CERTIFIED SOLUTION
Avatar of prosh0t
prosh0t

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rwallacej
rwallacej

ASKER

great :-)
hi,
 you can use Path class from System.IO, which have many defined usefull functions...

Ex:

Imports System.IO

dim strPath.strFileName as String
strFileName = Path.GetFileName(strPath)
Messagebox.Show(strFileName)