WebBrowser document cast not valid

前端 未结 1 667
耶瑟儿~
耶瑟儿~ 2020-12-11 13:22

I\'ve got a WebBrowser control on my page. To fire some javascript on a page displayed in the browser control, I call this.myBrowser.Document.InvokeScript(\"Test\");

相关标签:
1条回答
  • 2020-12-11 13:38

    Figured it out. My call was being invoked from a serial port data received event, which doesn't execute on the main GUI thread. I used a this.Invoke() method call to get my code to execute on the main GUI thread, all is good now!

    0 讨论(0)
提交回复
热议问题