FileDialog.Title Property
Assembly: System.Windows.Forms (in system.windows.forms.dll)
[LocalizableAttribute(true)] public: property String^ Title { String^ get (); void set (String^ value); }
/** @property */ public String get_Title () /** @property */ public void set_Title (String value)
public function get Title () : String public function set Title (value : String)
Property Value
The file dialog box title. The default value is an empty string ("").The following code example demonstrates initializing an OpenFileDialog, setting the Title and Filter properties, and allowing the user to select multiple files by setting the OpenFileDialog.Multiselect property to true. To run this example, paste the following code in a form containing an OpenFileDialog named OpenFileDialog1 and a Button named fileButton. Call the InitializeOpenFileDialog method in the form's constructor or Load method. The example also requires that the Click event of the Button control is connected to the event handler defined in the example.
void InitializeOpenFileDialog() { this->OpenFileDialog1 = gcnew System::Windows::Forms::OpenFileDialog; // Set the file dialog to filter for graphics files. this->OpenFileDialog1->Filter = "Images (*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|" + "All files (*.*)|*.*"; // Allow the user to select multiple images. this->OpenFileDialog1->Multiselect = true; this->OpenFileDialog1->Title = "My Image Browser"; } void fileButton_Click( System::Object^ sender, System::EventArgs^ e ) { OpenFileDialog1->ShowDialog(); }
private void InitializeOpenFileDialog()
{
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
// Set the file dialog to filter for graphics files.
this.openFileDialog1.set_Filter("Images (*.BMP;*.JPG;*.GIF)|"
+ "*.BMP;*.JPG;*.GIF|All files (*.*)|*.*");
// Allow the user to select multiple images.
this.openFileDialog1.set_Multiselect(true);
this.openFileDialog1.set_Title("My Image Browser");
} //InitializeOpenFileDialog
private void fileButton_Click(Object sender, System.EventArgs e)
{
openFileDialog1.ShowDialog();
} //fileButton_Click
- FileIOPermission to set the file dialog box title. Associated enumeration: PermissionState.Unrestricted.
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.