Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to display HTML content on a Windows Form?

I want to display an HTML formatted content in my application preferably inside a Web Browser control.

I could create an HTML document first and then load it in the Web Browser control, but that is just too clumsy.

Is there any way I can load a string that contains HTML code directly into the Web Browser?

String = "<b>Hello</b> World"

Expected output: Hello World

I'm using Visual Basic 9 (VS2008).

like image 860
user57175 Avatar asked Jan 21 '09 13:01

user57175


2 Answers

You can do this by dragging a WebBrowser control onto your application and then adding the following code:

 webBrowser1.DocumentText = "<b>Hello</b> World";
like image 182
JaredPar Avatar answered Oct 01 '22 12:10

JaredPar


You can open the document object in the Web Browser control then:-

document.write("<b>Hello</b> World");
like image 43
AnthonyWJones Avatar answered Oct 01 '22 10:10

AnthonyWJones