Resolved WebBrowser.ActiveXInstance and NewWindow3 event

JohnH

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
1,721
Location
Norway
Programming Experience
10+
I "cloned" a VB.Net application to C# and in this I was casting WebBrowser.ActiveXInstance to SHDocVw.WebBrowser to handle the NewWindow3 event, but in the C# app the event no longer worked. After lots of debugging and researching I found that the assembly reference had "Embed Interop Types" set to True, changing it to False resolved the problem and I was now getting the NewWindow3 event correctly. Other events of the ax browser object didn't seem affected of this bug (?). Didn't find this solution when searching the web.
By the way, the VB app was a previous .Net version and didn't have 'embed interop' option.
 
Back
Top Bottom