J
Jimski
Hi,
I am using a WebBrowser (.NET 2.0) control on my form and want to
dynamically build the HTML for it.
However, I am unable to get the Browser to show the HTML I am writing
to the browser.
I am using the following code in a button click event on the form.
Why does the code below not work? At the time of
Application.DoEvents() the body contains HTML which I have
subsequently copied and displayed in another browser without any
issues?
Adding is just the first step, I would like to be able to add <DIV>
tags too and dynamically change the contents of those <DIV> tags at
runtime. So far I am not getting very far!
Help appreciated asap please!!
Regards
Jimski
htmlDisplay.Navigate("about:blank");
//Set document
HtmlDocument doc = htmlDisplay.Document.D;
while (doc.Body == null)
{
Application.DoEvents();
}
HtmlElement elementFrameworkTbl =
doc.CreateElement("TABLE");
doc.Body.AppendChild(elementFrameworkTbl);
elementFrameworkTbl.SetAttribute("border", "5");
elementFrameworkTbl.SetAttribute("height", "100%");
elementFrameworkTbl.SetAttribute("width", "100%");
HtmlElement tableRow = doc.CreateElement("TR");
elementFrameworkTbl.AppendChild(tableRow);
HtmlElement tableCell = doc.CreateElement("TD");
tableRow.AppendChild(tableCell);
tableCell.InnerText = "tableText";
Application.DoEvents();
I am using a WebBrowser (.NET 2.0) control on my form and want to
dynamically build the HTML for it.
However, I am unable to get the Browser to show the HTML I am writing
to the browser.
I am using the following code in a button click event on the form.
Why does the code below not work? At the time of
Application.DoEvents() the body contains HTML which I have
subsequently copied and displayed in another browser without any
issues?
Adding is just the first step, I would like to be able to add <DIV>
tags too and dynamically change the contents of those <DIV> tags at
runtime. So far I am not getting very far!
Help appreciated asap please!!
Regards
Jimski
htmlDisplay.Navigate("about:blank");
//Set document
HtmlDocument doc = htmlDisplay.Document.D;
while (doc.Body == null)
{
Application.DoEvents();
}
HtmlElement elementFrameworkTbl =
doc.CreateElement("TABLE");
doc.Body.AppendChild(elementFrameworkTbl);
elementFrameworkTbl.SetAttribute("border", "5");
elementFrameworkTbl.SetAttribute("height", "100%");
elementFrameworkTbl.SetAttribute("width", "100%");
HtmlElement tableRow = doc.CreateElement("TR");
elementFrameworkTbl.AppendChild(tableRow);
HtmlElement tableCell = doc.CreateElement("TD");
tableRow.AppendChild(tableCell);
tableCell.InnerText = "tableText";
Application.DoEvents();