Threading and webbrowser control

吃可爱长大的小学妹 提交于 2019-12-06 14:05:14

Somebody that answerd the question, gave the right answer. But for some reason, he deleted it, so thank you, but i don't remember your name...

This was the piece of code that worked:

webBrowser1.Invoke(new Action(() => {
                    HtmlElement lit = webBrowser1.Document.GetElementById("buildqueue");
                    result = "whatever";
                }));

Hmmm.

System.Windows.Forms.HtmlDocument.GetElementById() definitely returns a System.Windows.Forms.HtmlElement.

What happens if you change

HtmlElement lit = webBrowser1.Document.GetElementById("buildqueue");

to

System.Windows.Forms.HtmlElement lit = webBrowser1.Document.GetElementById("buildqueue");

Do you still get an invalid cast error?

I just happen to know that there are multiple commonly used classes called HtmlElement and I wonder if you've got one from another namespace imported.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!