title: Setting innerHtml property of web browser control in windows form
body: <p>I am working on windows form in which i am using Web Browser control to load some HTML content included in  tag.</p>
  
  <p>Now when I am trying to set the value of </p>
  
  <pre><code>       WebBrowserCntrl.Navigate("about:blank");
         HtmlDocument doc = this.WebBrowserCntrl.Document;
         doc.Write(String.Empty);
  WebBrowserCntrl.Document.Body.InnerHTML= datacontractclass.datamember(string)
  </code></pre>
  
  <p>it is throwing exception as "Object reference not set to an instance of an object." 
  But when I do the other way..</p>
  
  <p><code>WebBrowserCntrl.DocumentText="&lt;style&gt;....&lt;/style&gt;"
      WebBrowserCntrl.DocumentText= datacontractclass.datamember(string)</code> 
  it works.
  But then I am not able to change style of webbrowser.(like whatever style I have applied above) </p>
  
  <p>why I am getting this exception or is there any other way to append style and other HTMl content.</p>