Trying to get this line to work
mshtml.IHTMLDocument2 doc2 = webBrowser1.Document as mshtml.IHTMLDocument2;
but getting the error message
Error 10 Cannot convert type 'System.Windows.Forms.HtmlDocument' to 'mshtml.IHTMLDocument2' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion
Which I haven't come across before. I've done some searching and it seems many others have gotten that line to work? Any help / explanations greatly appreciated! Thanks!
Try something like the following:
MSHTML.IHTMLDocument2 currentDoc =
(MSHTML.IHTMLDocument2)webBrowser1.Document.DomDocument;
I found the reference online at: HtmlDocument.DomDocument - at MSDN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With