Click here to Skip to main content
15,911,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i wanna know How to get a file name when from savefiledialogue typed filename
Posted
Comments
[no name] 16-May-13 6:31am    
http://msdn.microsoft.com/en-us/library/system.windows.forms.savefiledialog_properties.aspx

1 solution

C#
SaveFileDialog1.FileName

This property of save dialog will give you the file name with path after you click the SAVE button on the dialog.

To get only file name with extension you can try this :
C#
System.IO.Path.GetFileName(SaveFileDialog1.FileName);


And without extension :
C#
System.IO.Path.GetFileNameWithoutExtension(SaveFileDialog1.FileName);
 
Share this answer
 
v2
Comments
sencsk 16-May-13 6:43am    
i already tried this. i dont need the full namespace. i want exact file name..
Mayur Panchal 16-May-13 6:44am    
with extention or without ??
sencsk 16-May-13 6:46am    
without exten.. for example i dont like("D:\Output.txt"). i need "Output" oly.
Mayur Panchal 16-May-13 6:48am    
You can try this:
System.IO.Path.GetFileName(SaveFileDialog1.FileName);
System.IO.Path.GetFileNameWithoutExtension(SaveFileDialog1.FileName);
sencsk 16-May-13 8:48am    
g8 man....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900