CommonDialogShowOpen method |
|
Remarks
Displays the standard dialog box used to select a file for opening. This method allows accessing filenames containing Unicode characters from development environments whose common dialog components don't manage Unicode natively like the "Microsoft Common Dialog Control" (ComDlg32.ocx) used by Visual Basic 6.
After choosing an input file, you can access more detailed information about it through the CommonDialogGetInfoFromLastOpen method.
Syntax
[Visual Basic] Public Function CommonDialogShowOpen ( strDialogTitle as string, strInitialDirectory as string, strFilter as string, nFilterIndex as Int32 ) as String |
[C#] public string CommonDialogShowOpen ( string strDialogTitle, string strInitialDirectory, string strFilter, ref Int32 nFilterIndex ); |
[C++] public: string CommonDialogShowOpen ( string strDialogTitle, string strInitialDirectory, string strFilter, Int32 __gc *nFilterIndex ); |
Parameter |
Description |
|
|
strDialogTitle |
String representing the caption text of the dialog box. |
strInitialDirectory |
String representing the path of the directory where the browsing starts from. |
strFilter |
String representing the filter that let users limit which filenames appear for selection. For example: "MP3 Files (*.mp3)|*.Mp3|WMA Files (*.wma)|*.wma|All Files (*.*)|*.*" |
nFilterIndex |
Reference that, on return from the method call, will contain the 1-based index of the filter selected by the user. |
Return value
Value |
Meaning |
|
|
Empty string |
The user pressed the Cancel button or didn't selected any file. |
Valid string |
The absolute pathname of the chosen file. |