Export (0) Print
Expand All

FileDialog.FileOk Event

Occurs when the user clicks on the Open or Save button on a file dialog box.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member FileOk : IEvent<CancelEventHandler,
    CancelEventArgs>

For information about handling events, see Handling and Raising Events.

The following code example demonstrates using the FileNames property, handling the FileOk event and using the Application.DoEvents method. When the example runs, a user can select graphics files from an OpenFileDialog object. The selected files are displayed in the form. The Application.DoEvents method forces a repaint of the form for each graphics file opened. To run this example paste the following code in a form containing a PictureBox named PictureBox1, an OpenFileDialog named OpenFileDialog1, and a Button named fileButton. Call the InitializePictureBox and InitializeOpenFileDialog methods from the form's constructor or Load method. When the example is running, display the dialog box by clicking the button.

No code example is currently available or this language may not be supported.

To run this example paste the following code in a form containing
a PictureBox named PictureBox1, an OpenFileDialog named OpenFileDialog1, 
and a button named fileButton.  Call the InitializePictureBox and 
InitializeOpenFileDialog methods from the form's constructor or 
Load method. When the example is running, display the dialog by clicking
the button.    

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft