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