WebBrowser.Document.Body is always null
I have a WebBrowser document set to be in edit mode. I am trying to manipulate the inner text of the body element by using WebBrowser.Document.Body.InnerText , however, WebBrowser.Document.Body remains null. Here is the code where I create the document contents: private WebBrowser HtmlEditor = new WebBrowser(); public HtmlEditControl() { InitializeComponent(); HtmlEditor.DocumentText = "<html><body></body></html>"; myDoc = (IHTMLDocument2)HtmlEditor.Document.DomDocument; myDoc.designMode = "On"; HtmlEditor.Refresh(WebBrowserRefreshOption.Completely); myContentsChanged = false; } I can edit