private void button1_Click(object sender, System.EventArgs e)
{this
//瀏覽文件夾
this.folderBrowserDialog1.ShowDialog();spa
if(this.folderBrowserDialog1.SelectedPath.Trim()!="")string
this.textBox1.Text=this.folderBrowserDialog1.SelectedPath.Trim();object
}foreach
private void button2_Click(object sender, System.EventArgs e)
{im
//顯示指定文件夾下的文件
if(this.textBox1.Text.Trim()=="")
return;文件
this.listBox1.Items.Clear();return
string[] MyFiles=System.IO.Directory.GetFiles(this.textBox1.Text);void
this.listBox1.Items.AddRange(MyFiles);
//foreach(string File in MyFiles)
// this.listBox1.Items.Add(File);
}