OpenFileDialog dlg = new OpenFileDialog();
dlg.DefaultExt = "xls";
dlg.Filter = "Text Files(*.xls)|*.xls||";
if (dlg.ShowDialog() == DialogResult.OK)
{
string filePath = dlg.FileName;
txtSourceFileName.Text=filePath;
}
'調用外部應用程序打開選擇的文件
string OpenFileName;
OpenFileName=txtSourceFileName.Text;
ProcessStartInfo pInfo = new ProcessStartInfo();
pInfo.UseShellExecute = true;
if (File.Exists(OpenFileName))
{
pInfo.FileName = OpenFileName;
//啟動進程
Process p = Process.Start(pInfo);
}