Create HTML on the Fly with the MS Internet Control

Category:
Forms and Controls
Type:
Snippets
Difficulty:
Beginning
Author:
Anonymous

Version Compatibility: Visual Basic 6

More information:
With the two Sub procedures below, you can create HTML on the fly, instead of typically loading a document with the Navigate() method. Here, we use the Navigate() method to load the about:blank page. Once this page is loaded, the web control (MS Internet Control) loads the DOM and fires the DocumentComplete event. This event provides you access to the top-level, or frame, web browser object and the URL/UNC file name to the loaded document. Once you are inside your event handler, you simply set an HTMLDocument type variable to your web control's document object and set the innerHTML property to your dynamically created HTML. You can reference the documentation for this event at http://msdn2.microsoft.com/en-us/library/aa768329.aspx.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: