获取值也有错吗??看看下面的注释。
private void axWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
if (_ActiveWebBrowser.ReadyState == SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
{ HtmlDocument htmldoc;
SHDocVw.IWebBrowser2 tBrowser = e.pDisp as SHDocVw.IWebBrowser2;
htmldoc = (HtmlDocument)tBrowser.Document;
///运完上面这句程序,下面的都不运行了。
HE_WebBrowserTag _HE_WebBrowserTag = (HE_WebBrowserTag)_ActiveWebBrowser.Tag;
if (_HE_WebBrowserTag._TabIndex == tabControl1.SelectedIndex)
{txbURLLocation.Text = _ActiveWebBrowser.LocationURL;}
progressBar1.Value = 0;
progressBar1.Visible = false;
tlbPrint.Enabled = IsPrinterEnabled();
} }
private void axWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
if (_ActiveWebBrowser.ReadyState == SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
{ HtmlDocument htmldoc;
SHDocVw.IWebBrowser2 tBrowser = e.pDisp as SHDocVw.IWebBrowser2;
htmldoc = (HtmlDocument)tBrowser.Document;
///运完上面这句程序,下面的都不运行了。
HE_WebBrowserTag _HE_WebBrowserTag = (HE_WebBrowserTag)_ActiveWebBrowser.Tag;
if (_HE_WebBrowserTag._TabIndex == tabControl1.SelectedIndex)
{txbURLLocation.Text = _ActiveWebBrowser.LocationURL;}
progressBar1.Value = 0;
progressBar1.Visible = false;
tlbPrint.Enabled = IsPrinterEnabled();
} }
改到下面这样正常了。mshtml.IHTMLDocument2 document = (mshtml.IHTMLDocument2)axWebBrowser1.Document;
哈哈。散分了。
我最近在用webbrowser,就这么写的啊
HtmlDocument v = null;
v = WB.Document.Window.Frames[en].Document;