views:

896

answers:

3

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).

Thank you.

+3  A: 

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

document.write("<b>Hello</b> World");
AnthonyWJones
This will only work if the web browser object is currently navigated somewhere. Otherwise the document property will be null.
JaredPar
@JaredPar: he could navigate to "about:blank"
splattne
+7  A: 

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

    webBrowser1.DocumentText = "<b>hello</b> world"
JaredPar
A: 

Is it possible to display it in a text box?

Uday