private void Btnfile_click (object sender, EventArgs e) {OpenFileDialog FileDialog = new OpenFileDialog (); Filedialog.mult iselect = true; Filedialog.title = "Please select File"; Filedialog.filter= "All Documents (*. *) |*.*"; if (filedialog.showdialog () = = DialogResult.OK) {string file=filedialog.filename; MessageBox.Show ("Selected files:" + file, "Select File Hint", messageboxbuttons.ok,messageboxicon.information);}} private void Btnpath_click (object sender, EventArgs e) {folderbrowserdialog dialog = new FolderBrowserDialog (); dialog. Description = "Please select file path"; if (dialog. ShowDialog () = = DialogResult.OK) {string foldpath = dialog. SelectedPath; MessageBox.Show ("Selected folder:" + Foldpath, "Select Folder Hint", MessageBoxButtons.OK, MessageBoxIcon.Information);}} private void Btnopen_click (object sender, EventArgs e) {System.Diagnostics.Process.Start ("Explorer.exe", "C:\\Windows "); }
C#winform Select files, folders, open the specified directory method