System.Windows.Forms.HtmlDocument and mshtml.HTMLDocument

G

Guest

Hi,

VS2005, C#

I have developed a UserControl embedded in a HTML web page. And I can
access to the DOM with the following code:

HTML page:

……..
<BODY onload=loadDoc()>
…….
<script type="text/javascript">

function loadDoc()
{
//passing the document as a parameter to our UserControl
document.form1.myobject.doc = document;
}

</script>
….

C# User control:

private mshtml.HTMLDocument DocVal;

public mshtml.HTMLDocument Doc
{
get { return DocVal; }
set
{
DocVal = value;
}
}


Fine, perfect I can access to the DOM!!


Problem Microsoft has dropped this control from the .net2 framework. And all
the indications are to use: System.Windows.Forms.HtmlDocument.

Ok fine even better I can get rid off the interop I thought, but when I
replace mshtml.HTMLDocument with System.Windows.Forms.HtmlDocument, so:

private System.Windows.Forms.HtmlDocument DocVal;

public System.Windows.Forms.HtmlDocument Doc
{
get { return DocVal; }
set
{
DocVal = value;
}
}




Internet Explorer throw an error saying: Error class does not support
automation!

in the line: document.form1.myobject.doc = document;


Any suggestions on how to use System.Windows.Forms.HtmlDocument ?



Many thanks,
Filippo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top