Http://www.cnblogs.com/zhlziliaoku/p/5241097.html
1. Select File with OpenDialog
Newtrue; " Please select folder "" All Files (*. *) |*.*"; if (dialog. ShowDialog () = =String file = dialog. FileName;}
The Filter property is assigned a string to filter the file type, and the string is described as follows: ' | ' Split two, one is a comment, one is a true filter, and the comment is displayed. If you want to display files of more than one type at a time, separate them with semicolons. such as: open1.filter=" picture file (*.jpg,*.gif,*.bmp) |*.jpg;*.gif;*.bmp"; Thefilter file type is "|" *.jpg;*.gif;*.bmp three types of files on the right, and the file type strings shown to the user in Opendialog/savedialog are: "|" Image file (*.jpg,*.gif,*. bmp) to the left of the number. Again such as: open1.filter=" image file (*.jpg;*.jpg;*.jpeg;*.gif;*.png) |*.jpg;*.jpeg;*.gif;*.png";
2. Use System.Windows.Forms.FolderBrowserDialog to select folders
System.Windows.Forms.FolderBrowserDialog dialog =NewSystem.Windows.Forms.FolderBrowserDialog ();d ialog. Description ="Please select the folder where TXT is located";if (dialog. ShowDialog () = =System.Windows.Forms.DialogResult.OK) {if (String. IsNullOrEmpty (dialog. SelectedPath)) {System.Windows.MessageBox.Show (This , " folder path cannot be empty ", " hint "); return;} This . Loadingtext = " in Process ... "; This . Loadingdisplay = true; action<string> a = daorudata; a.begininvoke (dialog. Selectedpath,asynccallback, a);}
3. Open a file or folder directly under a path
System.Diagnostics.Process.Start ("ExpLore"C:\\window ");
C # Select a file, select a folder, open a file (or a folder)