if (webBrowserControl.Document == null) is throwing an
InvalidCastException.
PLEASE NOTE: ***The function being called is being called from a
thread OTHER THAN than the one that created the WebBrowser
control.*** So, I think making a delegate to invoke the function from
the proper thread will solve the problem. But, I just want to know:
Why is the above exception happening? Where is the cast?
The StackTrace for the exception (there is no InnerException):
" at
System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation()\r
\n at System.Windows.Forms.WebBrowser.get_Document()\r\n at MY OWN
FUNCTION... etc."
So, I guess the answer is in the above function.
Zytan
Zytan - 27 Mar 2007 18:54 GMT
> PLEASE NOTE: ***The function being called is being called from a
> thread OTHER THAN than the one that created the WebBrowser
> control.*** So, I think making a delegate to invoke the function from
> the proper thread will solve the problem.
Yes, it does fix the problem, as I expected.
Zytan
RuMiL - 21 Jun 2007 18:06 GMT
Could you tell me how did you solve the problem with the delegate please?
Would be great if you see this message as soon as possible :S
Thanks in advance.
>> PLEASE NOTE: ***The function being called is being called from a
>> thread OTHER THAN than the one that created the WebBrowser
[quoted text clipped - 4 lines]
>
>Zytan