FileDialog.FileName Property
Gets or sets a string containing the file name selected in the file dialog box.
[Visual Basic] Public Property FileName As String [C#] public string FileName {get; set;} [C++] public: __property String* get_FileName(); public: __property void set_FileName(String*); [JScript] public function get FileName() : String; public function set FileName(String);
Property Value
The file name selected in the file dialog box. The default value is an empty string ("").
Remarks
The file name includes both the file path and the extension. If no files are selected, this method returns an empty string ("").
When used from the SaveFileDialog class, this property represents the file being saved; when used from the OpenFileDialog class, it represents the file being opened.
This property can only be the name of one selected file. If you want to return an array containing the names of all selected files in a multiple-selection dialog box, use FileNames.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
.NET Framework Security:
- FileIOPermission to get or set the file name. Associated enumeration: PermissionState.Unrestricted.
See Also
FileDialog Class | FileDialog Members | System.Windows.Forms Namespace | FileNames | SaveFileDialog | OpenFileDialog