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);
}
新聞熱點
疑難解答