Place a WebBrowser control on the form.
The WebBrowser control has a Document property that returns an object of type HTMLDocument. To use this object, you need a reference to a Microsoft HTML library. Select the Project menu's References command, select the Microsoft HTML Object Library entry, and click OK.
(Note: You can use the Document property as a generic Object if you don't want to include the reference. It will be a little slower but should still work.)
When the form loads, the Form_Load event handler sets some default HTML text in the txtHtml TextBox. It then makes the WebBrowser control go it the system's defined home page. This is necessary because the WebBrowser's Document property returns Nothing unless the control is displaying something.
When the user clicks Set Contents, the program gets the WebBrowser's Document property. It sets that object's body.innerHTML property to the HTML text in the TextBox.
|