引用》在出現的"添加引用"的對話框中選擇COM選項卡,選擇Microsoft Internet Controls(對應的DLL文件是shdocvw.dll)
using System.Diagnostics;
Process ps=new Process();
ps.StartInfo.FileName="iexplore.exe";
ps.StartInfo.Arguments="http://localhost/myasp";
ps.Start();
直接調用:
System.Diagnostics.Process.Start("iexplore.exe","www.csdn.net" );
如果要放在窗體裏:
在工具箱裏右擊,選添加/刪除選項,在彈出的對話框裏選Com組件選項卡,找到Microsof Web瀏覽器組件,確定,
在工具箱裏選擇WebBrowser控件,拖放到窗體上,然後寫代碼:
private void button1_Click(object sender, System.EventArgs e)
{
string str="";
System.Object nullObject=0;
System.Object nullObjStr=str;
this.axWebBrowser1.Navigate("www.csdn.net",ref nullObject,ref nullObjStr,ref nullObjStr,ref nullObjStr);
}