Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I have made a usercontrol with a webbrowser control in it.
this usercontrol is placed on a form named form2(in another windows form project).
form2 is called/launched from form1 with a button.
I want to set the body.innerhtml of the usercontrol, but can't get it to work. Maybee i'm missing something or overlook something.
If i place a button on form2 and call the setHTML then it works fine.
But what i want is from the button on form1, open form2 and pass a value to setHTML of the usercontrol.

Can you help me with this one ?

Thanks, Danny.

the code i'm using for the user control is as follows,

C#
private mshtml.IHTMLDocument2 doc;
private string EditInnerHtml;
public UserControl1()
{
    InitializeComponent();
}
public void setHTML(String html)
{
    EditInnerHtml = html;
    doc.body.innerHTML = EditInnerHtml;
}
private void UserControl1_Load(object sender, EventArgs e)
{
    doc = (mshtml.IHTMLDocument2)this.webBrowser1.Document.DomDocument;
    doc.designMode = "On";
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900