RE: Unable to cast COM object of type 'System.__ComObject' to class type 'mshtml.HTMLDocumentClass'



Hello,
Below is my existing code...
mshtml.IHTMLDocument3 doc = (mshtml.IHTMLDocument3)axWebBrowser1.Document;
string strHtml = ((mshtml.HTMLDocumentClass) (doc)).documentElement.outerHTML +
Environment.NewLine;

But I am getting error as......
Unable to cast COM object of type 'System.__ComObject' to class type 'mshtml.HTMLDocumentClass'. COM components that enter the CLR and do not support IProvideClassInfo or that do not have any interop assembly registered will be wrapped in the __ComObject type. Instances of this type cannot be cast to any other class; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.

Please Help,
bmchheda1@xxxxxxxxx


From http://www.developmentnow.com/g/21_2007_1_0_0_913194/Unable-to-cast-COM-object-of-type-System--ComObject-to-class-type-mshtml-HTMLDocumentClass.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/
.


Loading