FileDialog.FileName Property
Gets or sets a string containing the file name selected in the file dialog box.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Property Value
Type: System.StringThe file name selected in the file dialog box. The default value is an empty string ("").
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.
The following code example demonstrates using the RichTextBox.SaveFile and RichTextBox.LoadFile methods with streams. It also demonstrates using the FileName, DefaultExt, SaveFileDialog.CreatePrompt, and SaveFileDialog.OverwritePrompt members.
This is a complete example that is ready to run when you copy it to your project.
to get or set the file name. Associated enumeration: PermissionState.Unrestricted.
Available since 1.1