close

1.前言
WinFrom程式設計裡開啟選擇檔案的對話視窗

2.說明
程式碼:

private void btOpenFile_Click(object sender, EventArgs e)
{
	OpenFileDialog dialog = new OpenFileDialog();
	dialog.Title = "Select file";
	dialog.InitialDirectory = ".\\";
	dialog.Filter = "xls files (*.*)|*.xls";
	if (dialog.ShowDialog() == DialogResult.OK)
	{
		MessageBox.Show(dialog.FileName);
	}
}
arrow
arrow
    文章標籤
    C# OpenFileDialog
    全站熱搜

    西夏普 發表在 痞客邦 留言(0) 人氣()