實現效果:
知識運用:
FolderBrowserDialog組件的ShowDialog方法 //彈出選擇路徑對話框
public DialogResult ShowDialog()
和SelectedPath屬性 //獲取或設置用戶選定的路徑
public String SelectedPath {get;set;}
實現代碼:
private void button1_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) textBox1.Text = folderBrowserDialog1.SelectedPath; }