OpenFileDialog ofd = new OpenFileDialog();
// 預設路徑
if (string.IsNullOrEmpty(ofd.InitialDirectory))
ofd.InitialDirectory = "C:";
ofd.Filter = "Text Files (*.txt)|*.c; *.cpp|All Files (*.*)|*.*";
ofd.Title = "請開啟文字檔案";
if (ofd.ShowDialog(this) == DialogResult.Cancel)
return;
textBox1.Text = ofd.FileName;
回目錄
回首頁
沒有留言 :
張貼留言