日期:2014-05-18 浏览次数:20742 次
string file_Path = ""; DialogResult result = folderBrowserDialog1.ShowDialog(); if (result == DialogResult.OK) { file_Path = folderBrowserDialog1.SelectedPath; } else { return; }
------解决方案--------------------
System.Diagnostics.Process.Start("");
------解决方案--------------------
folderBrowserDialog 控件
如果要求打开指定类型文件这样做
this.openFileDialog1.Filter = "Txt文件(*.txt)|*.txt";//设置只能打开TXT文件
------解决方案--------------------
用folderBrowserDialog
private void button1_Click(object sender, EventArgs e) { textBox1.Text = ""; if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { textBox1.Text = folderBrowserDialog1.SelectedPath; } }
------解决方案--------------------
用directory试试,肯定可以
------解决方案--------------------
这个可以选文件
private void button1_Click(object sender, EventArgs e) { textBox1.Text = ""; OpenFileDialog open = new OpenFileDialog(); open.InitialDirectory = Directory.GetCurrentDirectory(); open.RestoreDirectory = true; if (open.ShowDialog() == DialogResult.OK) { textBox1.Text =open.FileName; } }
------解决方案--------------------
见三楼。你可以自己指定打开哪种类型的文件,也可以什么类型的都打开