有关WebBrowser控件,提示错误Document.Body为空
private void test_Load(object sender, EventArgs e)
{
webBrowser1.DocumentText = "<html><body></body></html>";
AppendText("...");
}
private void AppendText(String text)
{
if (webBrowser1.Document != null)
{
HtmlDocument doc = webBrowser1.Document;
HtmlElement textElem = doc.CreateElement("DIV");
textElem.InnerText = text;
doc.Body.AppendChild(textElem);
}
}
------------------------------------------
为啥呀?该怎么用?
webbrowser
------解决方案-------------------- webBrowser1.DocumentText = "<html><body></body></html>";
AppendText("...");
---
网页没加载完成,自然没东西了
放在documentcomple里面