OpenFileDialog.OpenFile Method ()
.NET Framework (current version)
Opens the file selected by the user, with read-only permission. The file is specified by the FileName property.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
| Exception | Condition |
|---|---|
| ArgumentNullException | The file name is null. |
The OpenFile method is used to provide a facility to quickly open a file from the dialog box. The file is opened in read-only mode for security purposes. To open a file in read/write mode, you must use another method, such as FileStream.
FileDialogPermission
to open a file. Associated enumeration: FileDialogPermissionAccess.Open.
.NET Framework
Available since 1.1
Available since 1.1
Show: