Private voidBtnfile_click (Objectsender, EventArgs e) {OpenFileDialog FileDialog=NewOpenFileDialog (); Filedialog.multiselect=true; Filedialog.title="Please select a file"; Filedialog.filter="All Files (*. *) |*.*";if(Filedialog.showdialog () = =DialogResult.OK) {stringfile=Filedialog.filename; MessageBox.Show ("file selected:"+ File,"Select File Hints", messageboxbuttons.ok,messageboxicon.information);}}Private voidBtnpath_click (Objectsender, EventArgs e) {FolderBrowserDialog Dialog=NewFolderBrowserDialog ();d ialog. Description="Please select a file path";if(dialog. ShowDialog () = =DialogResult.OK) {stringFoldpath =dialog. SelectedPath; MessageBox.Show ("folder selected:"+ Foldpath,"Select folder Hints", MessageBoxButtons.OK, messageboxicon.information);}}Private voidBtnopen_click (Objectsender, EventArgs e) {System.Diagnostics.Process.Start ("Explorer.exe","C:\\Windows");}
C#winform Select files, folders, open the specified directory method