views:

36

answers:

0

Hi,

My app contains 2 webbrowsers and 2 threads. The browsers run separate on each thread. Both have been added to the Form in a tabcontrol on different tabpages. Also got their own document_complete1 and 2 event.

The problem is, only 1 webbrowser has documentText after WebBrowserDocumentCompletedEventArgs event fires which is the webbrowser1.

The second webbrowser's documentText property is always empty, and the output window shows this:

A first chance exception of type 'System.InvalidCastException' occurred in System.Windows.Forms.dll

A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll

The threads and browsers are identical, the only difference is the page they navigate to.

What am I missing?

Thanks in advance!