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);
}
<> <>