FileDialog.FileOk Event

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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.

.NET Framework
Available since 1.1
Return to top
Show: