Connecting Tech Pros Worldwide Help | Site Map

get only fileName from OpenFileDialog

Member
 
Join Date: Nov 2007
Posts: 125
#1: 4 Weeks Ago
hello,

i find that if i use the OpenFileDialog1.fileName, i get the fullpath + the name of the file selected by the user.

how to get only the filename and its extension but without the path to the file?

Thank you.
best answer - posted by tlhintoq
Take a look on the MSDN for System.IO.Path namespace.
It has a lot of methods for .GetFileName() .GetFileNameWithoutExtension() and so on.

http://msdn.microsoft.com/en-us/libr...h_methods.aspx
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,743
#2: 4 Weeks Ago

re: get only fileName from OpenFileDialog


Take a look on the MSDN for System.IO.Path namespace.
It has a lot of methods for .GetFileName() .GetFileNameWithoutExtension() and so on.

http://msdn.microsoft.com/en-us/libr...h_methods.aspx
Member
 
Join Date: Nov 2007
Posts: 125
#3: 4 Weeks Ago

re: get only fileName from OpenFileDialog


hi!,

thanks tlhintoq. i'll give it a try.
Reply