指定的转换无效 的问题
本帖最后由 qq2593010346 于 2012-12-23 15:44:11 编辑 界面上有一个浏览器,通过以下语句会出现 "InvalidCastException 指定的转换无效" 错误
//
//
private void extendedWebBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(aa));
}
private void aa(object obj)
{
string sourceStr=extendedWebBrowser1.Document.Body.InnerHtml.ToString();//指定的转换无效
}
//
//
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(this.GetDocHtml));
}
private void GetDocHtml(object o)
{
Func<string> f = new Func<string>(GetHtml);
object html = this.Invoke(f);
MessageBox.Show(html.ToString());
}
private string GetHtml()
{
return webBrowser1.Document.Body.InnerHtml;
}