hi, i like to ask if there anyway that i can get the filename from openfiledialog. I just want the filename and not the all pathway.
Below is the coding i have done.
openFileDialog.showDialog();
textfile = openFileDialog.FileName;
but this will give me the pathway of the file
e.g. (C:\Documents and Settings\Annicia\Desktop\annicia\SQL Server.exe) but i only want the filename (SQL Server.exe).
If there anyway i can do it as i am quite new to c# can guide me along, thank.
How to retrieve the filename from openfiledialog
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Andrzej WegierskiRank #1,735 · 865 pointsPosted Sep 2, 2005, 12:23 AM EDT
Vicky3 pointsPosted Sep 2, 2005, 12:26 AM EDT
Path.GetFileName( string FullPath).
This returns the file name alone.
1 short reply
nicia7 pointsPosted Sep 4, 2005, 10:06 PM EDT