Friday, February 26, 2010

Working with WebBrowser Control

One of the most interesting issues I had experienced and which for I was not able to find a solution in inet - was problem related to WebBrowser control.
The thing is that when I was trying to access the Document property of the WebBrowser control instance, I was getting "Invalid cast exception".
The thing is that the WebBrowser control is designed to work in one thread. So to fix this you must only check the InvokeRequired property and if it's value is true, then call the logic from the delegate, given into browser.Invoke(...) method.
This is all the stuff.
Lucky coding ...

No comments: