ShareThis

Wednesday, December 19, 2012

[C#] Get ONLY filename and extension from OpenDialog in C# WinForms

All you need to do in order to get the filename from an OpenDialog in C# is to use this method:

OpenFileDialog.SafeFileName

Example of an OpenFileDialog's FileName attribute: C://fakepath//item.txt
Example of an OpenFileDialog's SafeFileName attribute: item.txt

0 comments:

Post a Comment