Windows Develop Bookmark and Share   
 index > Windows Forms General > FileName without Path in OpenFileDialog
 

FileName without Path in OpenFileDialog

I have this code:

Code Snippet

String ds;
OpenFileDialog search = new OpenFileDialog();
search.Multiselect = false;
search.Title = "Select the file";
search.Filter = "Text file (*.txt)|*.txt";
if (search.ShowDialog() == DialogResult.OK)
{
ds = search.FileName.ToString();
}



So i wanted to have the name of the file without all the absolute Path but i don't know how to do this. Are there any way to have Only the name ??

Thanks a lot

AnHeLL  Thursday, May 17, 2007 11:27 AM
Hi,
System.IO.Path.GetFileName(fileName);
Regards,
nielsvanvliet  Thursday, May 17, 2007 11:46 AM
Hi,
System.IO.Path.GetFileName(fileName);
Regards,
nielsvanvliet  Thursday, May 17, 2007 11:46 AM

You can use google to search for other answers

Custom Search

More Threads

• How to check WebBrower.Navigate's resulting status?
• Delete Key DataGrid
• fill treeview
• trying to covert VS2005 project into VS2008
• Help to make windows application like master page
• Visual Studio Common/All Properties
• Problem with AxFramerControl when display Excel documents
• Interactive 3D Panel
• Convert win app to asp.net???
• pls help urgent - user ocntrol drag & drop C#