How to display the string html contents into webbrowser control?

前端 未结 9 1567
不知归路
不知归路 2020-11-27 06:47

I have a c# win app program. I save the text with html format in my database but I want to show it in a webbrowser to my user.How to display the string html contents into we

9条回答
  •  清酒与你
    2020-11-27 07:29

    Instead of navigating to blank, you can do

    webBrowser1.DocumentText="0";
    webBrowser1.Document.OpenNew(true);
    webBrowser1.Document.Write(theHTML);
    webBrowser1.Refresh();
    

    No need to wait for events or anything else. You can check the MSDN for OpenNew, while I have tested the initial DocumentText assignment in one of my projects and it works.

提交回复
热议问题