Esempio n. 1
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            CommonDialog dlgx = null;

            try
            {
                dlgx = new FolderBrowserDialogEx();
                var dlg2 = (FolderBrowserDialogEx)dlgx;
            }
            catch
            {
                dlgx = new FolderBrowserDialog();
            }

            var dlg1 = (FolderBrowserDialogEx)dlgx;

            dlg1.Description             = "Select a folder or file";
            dlg1.ShowNewFolderButton     = true;
            dlg1.ShowEditBox             = true;
            dlg1.NewStyle                = true;
            dlg1.ShowFullPathInEditBox   = false;
            dlg1.RootFolder              = System.Environment.SpecialFolder.MyComputer;
            dlg1.ShowBothFilesAndFolders = true;

            // Show the FolderBrowserDialog.
            DialogResult result = dlg1.ShowDialog();

            if (result == DialogResult.OK)
            {
                txtSubPath.Text = dlg1.SelectedPath;
            }
        }
Esempio n. 2
0
        public static FolderBrowserDialogEx ComputerBrowser()
        {
            FolderBrowserDialogEx x = new FolderBrowserDialogEx();

            // avoid MBRO comppiler warning when passing _rootFolderLocation as a ref:
            x.BecomeComputerBrowser();
            return(x);
        }