System.Windows.Forms.CommonDialog.ShowDialog()

Here are the examples of the csharp api class System.Windows.Forms.CommonDialog.ShowDialog() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

1. Example

Project: sharpneat
Source File: MainForm.cs
private string SelectFileToOpen(string dialogTitle, string fileExtension, string filter)
		{
			OpenFileDialog oDialog = new OpenFileDialog();
			oDialog.AddExtension = true;
			oDialog.DefaultExt = fileExtension;
            oDialog.Filter = filter;
			oDialog.Title = dialogTitle;
			oDialog.RestoreDirectory = true;

            // Show dialog and block until user selects a file.
			if(oDialog.ShowDialog() == DialogResult.OK) {
				return oDialog.FileName;
            } 
            // No selection.
            return null;
		}

2. Example

Project: sharpneat
Source File: MainForm.cs
private string SelectFileToSave(string dialogTitle, string fileExtension, string filter)
		{
			SaveFileDialog oDialog = new SaveFileDialog();
			oDialog.AddExtension = true;
			oDialog.DefaultExt = fileExtension;
            oDialog.Filter = filter;
			oDialog.Title = dialogTitle;
			oDialog.RestoreDirectory = true;

            // Show dialog and block until user selects a file.
			if(oDialog.ShowDialog() == DialogResult.OK) {
				return oDialog.FileName;
            } 
            // No selection.
            return null;
		}

3. Example

Project: Google.Music.Downloader
Source File: DownloadPage.xaml.cs
private void ButtonBrowse_OnClick(object sender, RoutedEventArgs e)
        {
            var dialog = new FolderBrowserDialog();
            var result = dialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                DirectoryTextBox.Text = dialog.SelectedPath;
            }
        }

4. Example

Project: ContinuousTests
Source File: DialogManager.cs
public string GetFileOpenPath(string title, string filter, string initialDirectory)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = title;
            dlg.Filter = filter;
            if (initialDirectory != null)
                dlg.InitialDirectory = initialDirectory;
            dlg.FilterIndex = 1;
            dlg.FileName = "";
            dlg.Multiselect = false;

            return dlg.ShowDialog() == DialogResult.OK
                ? dlg.FileNames[0]
                : null;
        }

5. Example

Project: ContinuousTests
Source File: DialogManager.cs
public string GetSaveAsPath(string title, string filter)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title = title;
            dlg.Filter = filter;
            dlg.FilterIndex = 1;
            dlg.FileName = "";

            return dlg.ShowDialog() == DialogResult.OK
                ? dlg.FileName
                : null;
        }

6. Example

Project: ContinuousTests
Source File: DialogManager.cs
public string GetFolderPath(string message, string initialPath)
        {
            FolderBrowserDialog browser = new FolderBrowserDialog();
            browser.Description = message;
            browser.SelectedPath = initialPath;
            return browser.ShowDialog() == DialogResult.OK
                ? browser.SelectedPath
                : null;
        }

7. Example

Project: ContinuousTests
Source File: ConfigurationForm.cs
private void buttonBrowse_Click(object sender, EventArgs e)
        {
            if (_isInitializing)
                return;
            var dialog = new OpenFileDialog();
            if (dialog.ShowDialog() == DialogResult.OK)
                textBoxIgnoreFile.Text = dialog.FileName;
        }

8. Example

Project: ContinuousTests
Source File: ConfigurationForm.cs
private void buttonMinAsmBrowse_Click(object sender, EventArgs e)
        {
            var open = new OpenFileDialog();
            open.Filter = "*(*.exe;*.dll)|*.exe;*.dll";
            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                textBoxMinimizerAssembly.Text = open.FileName;
        }

9. Example

Project: ContinuousTests
Source File: VersionedConfigOption.cs
private void buttonBrowse_Click(object sender, EventArgs e)
        {
            var dlg = new OpenFileDialog();
            if (dlg.ShowDialog() == DialogResult.OK)
                textBoxPath.Text = dlg.FileName;
        }

10. Example

Project: ImageGlass
Source File: frmEditEditingAssocisation.cs
private void btnBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog o = new OpenFileDialog();
            o.CheckFileExists = true;

            if (o.ShowDialog() == DialogResult.OK)
            {
                txtAppPath.Text = o.FileName;
            }
        }

11. Example

Project: ImageGlass
Source File: frmSetting.cs
private void picBackgroundColor_Click(object sender, EventArgs e)
        {
            ColorDialog c = new ColorDialog()
            {
                AllowFullOpen = true
            };

            if (c.ShowDialog() == DialogResult.OK)
            {
                picBackgroundColor.BackColor = c.Color;
            }
        }

12. Example

Project: ImageGlass
Source File: ImageComparator.cs
private void btnChooseImage_Click(object sender, EventArgs e)
        {
            OpenFileDialog o = new OpenFileDialog();
            o.Filter = "Supported formats (" + GlobalSetting.SupportedExtensions + ") | " +
                GlobalSetting.SupportedExtensions;

            if (o.ShowDialog() == DialogResult.OK)
            {
                txtImagePath.Text = o.FileName;
            }
        }

13. Example

Project: ImageGlass
Source File: ImageComparator.cs
private void btnChooseFoler_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog f = new FolderBrowserDialog();
            f.ShowNewFolderButton = true;

            if (f.ShowDialog() == DialogResult.OK)
            {
                txtFolderPath.Text = f.SelectedPath;
            }
        }

14. Example

Project: ImageGlass
Source File: ImageMixture.cs
private void btnSaveAs_Click(object sender, EventArgs e)
        {
            SaveFileDialog s = ne/n ..... /n //View Source file for more details /n }

15. Example

Project: ImageGlass
Source File: frmEdit.cs
private void lnkBackColor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {

            ColorDialog c = new ColorDialog();
            c.FullOpen = true;
            if (c.ShowDialog() == DialogResult.OK)
            {
                this.BackColor = c.Color;
            }

        }

16. Example

Project: ImageGlass
Source File: frmEdit.cs
private void btnStatus_Click(object sender, EventArgs e)
        {
            ColorDialog c = new ColorDialog();
            c.FullOpen = true;
            if (c.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                btnStatus.ForeColor = c.Color;
            }
        }

17. Example

Project: xcom2-launcher
Source File: SettingsDialog.cs
private void AddModPathButtonOnClick(object sender, EventArgs eventArgs)
        {
            var dialog = new FolderBrowserDialog
            {
                ShowNewFolderButton = true,
                RootFolder = Environment.SpecialFolder.MyComputer,
                Description = "Add a new mod path. Note: This should be the directory that contains the mod directories."
            };

            if (dialog.ShowDialog() != DialogResult.OK)
                return;

            Settings.ModPaths.Add(dialog.SelectedPath);
            modPathsListbox.Items.Add(dialog.SelectedPath);
        }

18. Example

Project: Cloney
Source File: PathSelectorBase.cs
private DialogResult OpenPathSelectorForFolder()
        {
            var dialog = new FolderBrowserDialog { SelectedPath = Path };
            if (DialogTitle != null)
                dialog.Description = DialogTitle;

            var result = dialog.ShowDialog();
            if (result == DialogResult.OK)
                Path = dialog.SelectedPath;

            return result;
        }

19. Example

Project: nextra
Source File: PrintDialogFacade.cs
public DialogResult ShowDialog()
        {
            return PrintDialog.ShowDialog();
        }

20. Example

Project: ocean-sql-profiler
Source File: FormOptions.cs
private void buttonBrowse1_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "Log Files (*.log)|*.log|All Files (*.*)|*.*";

            if (dialog.ShowDialog() != DialogResult.OK)
                return;

            textCommandLogLocation.Text = dialog.FileName;
        }

21. Example

Project: KcptunLauncher
Source File: ClientSelectForm.cs
private void browseBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofDlg = new OpenFileDialog();
            ofDlg.Filter = "(*.exe)|*.exe";
            ofDlg.FileName = "client_windows_amd64.exe";
            if (ofDlg.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = ofDlg.FileName;
            }
        }

22. Example

Project: ClientServerProject
Source File: FormAccountDetails.cs
private void userButton1_Click(object sender, EventArgs e)
        {
            // ??????
            TreeNode treeNode = treeView1.SelectedNode;
            if (treeNode.Name != "files_root")
            {
                // ?????
                using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
                {
                    folderBrowserDialog.Description = "?????????????????????";
                    if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
                    {
                        FormFileOperate download = new FormFileOperate(UserClient.Net_File_Client,
                                new string[] { treeNode.Text },
                                "Files",
                                "Personal",
                                UserClient.UserAccount.UserName,
                                folderBrowserDialog.SelectedPath
                                );
                        download.ShowDialog();
                    }
                }
            }
        }

23. Example

Project: ClientServerProject
Source File: FormUpdateRemote.cs
private void userButton_file_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Multiselect = true;
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    using (FormFileOperate fUpload = new FormFileOperate(
                        UserClient.Net_Update_Client,
                        ofd.FileNames,
                        "ClientFiles", 
                        "", 
                        ""
                        ))
                    {
                        fUpload.ShowDialog();
                    }
                }
            }
        }

24. Example

Project: Quad64
Source File: MainForm.cs
private void saveROMAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.Filter = "Z64 ROM|*.z64|V64 ROM|*.v64|N64 ROM|*.n64|All Files|*";
            DialogResult result = saveFileDialog1.ShowDialog();
            if (result == DialogResult.OK) // Test result.
            {
                if(saveFileDialog1.FilterIndex == 1)
                    ROM.Instance.saveFileAs(saveFileDialog1.FileName, ROM_Endian.BIG);
                else if (saveFileDialog1.FilterIndex == 2)
                    ROM.Instance.saveFileAs(saveFileDialog1.FileName, ROM_Endian.MIXED);
                else if (saveFileDialog1.FilterIndex == 3)
                    ROM.Instance.saveFileAs(saveFileDialog1.FileName, ROM_Endian.LITTLE);
            }
        }

25. Example

Project: Quad64
Source File: LaunchROM.cs
public static void setEmulatorPath()
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Title = "Select N64 emulator program";
            openFileDialog1.InitialDirectory = "C:\\Program Files (x86)\\";
            openFileDialog1.Filter = "EXE|*.exe|All Files|*";
            DialogResult result = openFileDialog1.ShowDialog();
            if (result == DialogResult.OK) // Test result.
            {
                Globals.pathToEmulator = openFileDialog1.FileName;
            }
        }

26. Example

Project: PhotonSharp
Source File: MainForm.cs
private void openFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "pho files (*.pho)|*.pho";
            dialog.FilterIndex = 1;
            dialog.RestoreDirectory = true;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                _currFile = dialog.FileName;
                _debugBox.Stop();                
                _debugBox.Start(_currFile);
            }
        }

27. Example

Project: Depressurizer
Source File: DlgGame.cs
private void btnBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            try
            {
                FileInfo f = new FileInfo(txtExecutable.Text);
                dlg.InitialDirectory = f.DirectoryName;
                dlg.FileName = f.Name;
            }
            catch (ArgumentException) { }

            DialogResult res = dlg.ShowDialog();
            if (res == DialogResult.OK)
            {
                txtExecutable.Text = dlg.FileName;
            }
        }

28. Example

Project: Depressurizer
Source File: DlgOptions.cs
private void cmdSteamPathBrowse_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dlg = new FolderBrowserDialog();
            DialogResult res = dlg.ShowDialog();
            if (res == DialogResult.OK)
            {
                txtSteamPath.Text = dlg.SelectedPath;
            }
        }

29. Example

Project: Depressurizer
Source File: DlgOptions.cs
private void cmdDefaultProfileBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            DialogResult res = dlg.ShowDialog();
            if (res == DialogResult.OK)
            {
                txtDefaultProfile.Text = dlg.FileName;
            }
        }

30. Example

Project: Depressurizer
Source File: DlgProfile.cs
private void cmdBrowse_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            try
            {
                FileInfo f = new FileInfo(txtFilePath.Text);
                dlg.InitialDirectory = f.DirectoryName;
                dlg.FileName = f.Name;
            }
            catch (ArgumentException) { }

            dlg.DefaultExt = "profile";
            dlg.AddExtension = true;
            dlg.Filter = GlobalStrings.DlgProfile_Filter;
            DialogResult res = dlg.ShowDialog();
            if (res == DialogResult.OK)
            {
                txtFilePath.Text = dlg.FileName;
            }
        }

31. Example

Project: Depressurizer
Source File: DlgSteamPath.cs
private void cmdBrowse_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dlg = new FolderBrowserDialog();
            DialogResult res = dlg.ShowDialog();
            if (res == DialogResult.OK)
            {
                txtPath.Text = dlg.SelectedPath;
            }
        }

32. Example

Project: DevExpress.Mvvm.Free
Source File: FileDialogServiceBase.cs
public DialogResult ShowDialog() {
                return fileDialog.ShowDialog();
            }

33. Example

Project: dp2
Source File: SetupMongoDbDialog.cs
private void button_findDataDir_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dir_dlg = new FolderBrowserDialog();

            dir_dlg.Description = "??? MongoDB ????:";
            dir_dlg.RootFolder = Environment.SpecialFolder.MyComputer;
            dir_dlg.ShowNewFolderButton = true;
            dir_dlg.SelectedPath = this.textBox_dataDir.Text;

            if (dir_dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_dataDir.Text = dir_dlg.SelectedPath;
        }

34. Example

Project: dp2
Source File: SetupMongoDbDialog.cs
private void button_findBinDir_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dir_dlg = new FolderBrowserDialog();

            dir_dlg.Description = "??? mongod.exe ????:";
            dir_dlg.RootFolder = Environment.SpecialFolder.MyComputer;
            dir_dlg.ShowNewFolderButton = false;
            dir_dlg.SelectedPath = this.textBox_binDir.Text;

            if (dir_dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_binDir.Text = dir_dlg.SelectedPath;
        }

35. Example

Project: dp2
Source File: ImportDataDialog.cs
private void button_findFileName_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "???????????";
            dlg.FileName = this.textBox_fileName.Text;
            dlg.Filter = "???? (*.dp2bak)|*.dp2bak|XML?? (*.xml)|*.xml|ISO2709?? (*.iso;*.mrc)|*.iso;*.mrc|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_fileName.Text = dlg.FileName;
        }

36. Example

Project: dp2
Source File: BerDebugForm.cs
private void button_findLogFilename_Click(object sender, EventArgs e)
        {
            // ?????????·??
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.FileName = this.textBox_logFilename.Text;
            //dlg.InitialDirectory = Environment.CurrentDirectory;
            dlg.Filter = "bin files (*.bin)|*.bin|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            this.textBox_logFilename.Text = dlg.FileName;
        }

37. Example

Project: dp2
Source File: CardPrintForm.cs
private void button_cardFile_findCardFilename_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "????????????";
            dlg.FileName = this.textBox_cardFile_cardFilename.Text;
            dlg.Filter = "???? (*.xml)|*.xml|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_cardFile_cardFilename.Text = dlg.FileName;

        }

38. Example

Project: dp2
Source File: InventoryFromFileDialog.cs
private void button_findBarcodeFileName_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "??????????????";
            dlg.FileName = this.textBox_barcodeFileName.Text;
            dlg.Filter = "?????? (*.txt)|*.txt|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_barcodeFileName.Text = dlg.FileName;
        }

39. Example

Project: dp2
Source File: OrderFileDialog.cs
private void button_findOutputFolder_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dlg = new FolderBrowserDialog();

            dlg.Description = "????????????:";
            dlg.RootFolder = Environment.SpecialFolder.MyComputer;
            dlg.SelectedPath = this.textBox_outputFolder.Text;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_outputFolder.Text = dlg.SelectedPath;
        }

40. Example

Project: dp2
Source File: QuickChangeBiblioForm.cs
private void button_file_getRecpathFilename_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "???????(???)???????";
            dlg.FileName = this.textBox_recpathFile.Text;
            // dlg.InitialDirectory = 
            dlg.Filter = "?????? (*.txt)|*.txt|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_recpathFile.Text = dlg.FileName;
        }

41. Example

Project: dp2
Source File: QuickChangeEntityForm.cs
private void button_saveToBarcodeFile_Click(object sender, EventArgs e)
        {
            // ???????
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title = "???????(??????)?????";
            dlg.OverwritePrompt = true;
            dlg.CreatePrompt = false;
            // dlg.FileName = this.LocalPath;
            // dlg.InitialDirectory = Environment.CurrentDirectory;
            dlg.Filter = "???? (*.txt)|*.txt|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            using (StreamWriter sw = new StreamWriter(dlg.FileName))
            {
                sw.Write(this.textBox_outputBarcodes.Text);
            }
        }

42. Example

Project: dp2
Source File: QuickChangeEntityForm.cs
private void button_file_getBarcodeFilename_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.FileName = this.textBox_barcodeFile.Text;
            dlg.Title = "?????????????";
            dlg.Filter = "????? (*.txt)|*.txt|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_barcodeFile.Text = dlg.FileName;
        }

43. Example

Project: dp2
Source File: QuickChangeEntityForm.cs
private void button_getRecPathFileName_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.FileName = this.textBox_recPathFile.Text;
            dlg.Title = "??????????????";
            dlg.Filter = "?????? (*.txt)|*.txt|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_recPathFile.Text = dlg.FileName;
        }

44. Example

Project: dp2
Source File: ExportPatronExcelDialog.cs
private void button_getOutputExcelFileName_Click(object sender, EventArgs e)
        {
            // ?????
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title = "??????? Excel ???";
            dlg.CreatePrompt = false;
            dlg.OverwritePrompt = false;
            dlg.FileName = this.textBox_outputExcelFileName.Text;
            // dlg.InitialDirectory = Environment.CurrentDirectory;
            dlg.Filter = "Excel ?? (*.xlsx)|*.xlsx|All files (*.*)|*.*";

            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_outputExcelFileName.Text = dlg.FileName;
        }

45. Example

Project: dp2
Source File: ItemClassStatisDialog.cs
private void button_getOutputExcelFileName_Click(object sender, EventArgs e)
        {
            // ?????
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title = "??????? Excel ???";
            dlg.CreatePrompt = false;
            dlg.OverwritePrompt = false;
            dlg.FileName = this.textBox_outputExcelFileName.Text;
            // dlg.InitialDirectory = Environment.CurrentDirectory;
            dlg.Filter = "Excel ?? (*.xlsx)|*.xlsx|All files (*.*)|*.*";

            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_outputExcelFileName.Text = dlg.FileName;
        }

46. Example

Project: dp2
Source File: OpenBiblioDumpFileDialog.cs
private void button_getObjectDirectoryName_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dir_dlg = new FolderBrowserDialog();

            dir_dlg.Description = "???????????:";
            dir_dlg.RootFolder = Environment.SpecialFolder.MyComputer;
            dir_dlg.ShowNewFolderButton = this.CreateMode;
            dir_dlg.SelectedPath = this.textBox_objectDirectoryName.Text;

            if (dir_dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_objectDirectoryName.Text = dir_dlg.SelectedPath;
        }

47. Example

Project: dp2
Source File: ConvertReportFormatDialog.cs
private void button_findReportDirectory_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dir_dlg = new FolderBrowserDialog();

            dir_dlg.Description = "?????????:";
            // dir_dlg.RootFolder = Environment.SpecialFolder.MyComputer;
            dir_dlg.ShowNewFolderButton = false;
            dir_dlg.SelectedPath = this.textBox_reportDirectory.Text;

            if (dir_dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_reportDirectory.Text = dir_dlg.SelectedPath;
        }

48. Example

Project: dp2
Source File: TestSearchForm.cs
private void button_searchBiblio_findFilename_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "?????????";
            dlg.FileName = this.textBox_biblioSearch_queryFilename.Text;
            dlg.Filter = "????? (*.xml)|*.xml|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_biblioSearch_queryFilename.Text = dlg.FileName;
        }

49. Example

Project: dp2
Source File: XmlStatisForm.cs
private void button_findInputXmlFilename_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "???????XML???";
            dlg.FileName = this.textBox_inputXmlFilename.Text;
            dlg.Filter = "XML?? (*.xml)|*.xml|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            this.textBox_inputXmlFilename.Text = dlg.FileName;

        }

50. Example

Project: dp2
Source File: ExportTemplateDlg.cs
private void button_findExportFileName_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.CreatePrompt = false;
            dlg.FileName = this.textBox_exportFileName.Text;
            dlg.Filter = "???? (*.template)|*.template|All files (*.*)|*.*";
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            this.textBox_exportFileName.Text = dlg.FileName;
        }