c# folderbrowserdialog

引用:http://blog.csdn.net/lynn_yan/article/details/5287990

http://zhidao.baidu.com/question/71730467.html?fr=qrl&cid=869&index=1&fr2=query

 private void button3_Click(object sender, EventArgs e)

        {

            System.Threading.Thread s = new System.Threading.Thread(new System.Threading.ThreadStart(test));

            s.ApartmentState = System.Threading.ApartmentState.STA;

            s.Start();}

        public void test()

        {

           

            FolderBrowserDialog browseDialog = new FolderBrowserDialog();

            browseDialog.ShowDialog();

            string selectPath = browseDialog.SelectedPath;

            textBox2.Text = selectPath;

        }

 

        private void textBox2_TextChanged(object sender, EventArgs e)

        {

 

        }

 

----------------------------------

// 设置根在桌面
folderBrowserDialog1.RootFolder = SpecialFolder.Desktop;

// 设置当前选择的路径
folderBrowserDialog1.SelectedPath = "C:";

// 允许在对话框中包括一个新建目录的按钮
folderBrowserDialog1.ShowNewFolderButton = true;

// 设置对话框的说明信息
folderBrowserDialog1.Description = "请选择输出目录";

if(folderBrowser.Dialog1.ShowDialog() == DialogResult.OK)
{

// 在此添加代码,选择的路径为 folderBrowserDialog1.SelectedPath

}

你可能感兴趣的:(browser)