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);
}
新闻热点
疑难解答