The following code will work with the following requirements:

  1. You are using .NET Framework 2.0
  2. You already have WebBrowser control added into your Windows Form
public void DisplayHTML(String strHTML)
{
    if (strHTML != "")
    {
         if (this.webBrowser2.Document != null)
         {
               HtmlDocument doc = this.webBrowser2.Document.OpenNew(true);
               doc.Write(strHTML);
         }
         else
         {
               this.webBrowser2.DocumentText = strHTML;
         }
     }
}

Powered by Gregarious (42)

Share This