Visual Basic Concepts
The first step in authoring the ActXDoc project is to add a single UserDocument object to an ActiveX EXE project. A CommandButton and a TextBox control are then added to the form. Finally, using the Hyperlink object, you add code that navigates to another URL.
The step-by-step procedures in this chapter build a document object and test it in Internet Explorer, which is included with Visual Basic.
Note This topic is part of a series that walks you through creating a sample ActiveX document. It begins with the topic Creating an ActiveX Document.
To create an ActiveX document
Visual Basic automatically adds a UserDocument designer to the project. If the designer is not immediately visible, right-click over its default name, UserDocument1, in the Project Explorer window, then click View Object. When the designer appears, its default name is visible in the title bar.
Command1 property | Value |
Name | cmdNavigateTo |
Caption | Navigate To |
Text1 property | Value |
Name | txtURL |
Text | http://www.microsoft.com |
Private Sub cmdNavigateTo_Click()
' Use the Hyperlink object method NavigateTo
' to go to the URL in txtURL.
Hyperlink.NavigateTo txtURL.Text
End Sub
Important When using the NavigateTo method, you must include the protocol portion of the URL. For example, by default, the above code will navigate to the value of the Text property of the txtURL TextBox control — "http://www.microsoft.com".
File | File name | Extension |
User document | FirstDoc | .dob |
Project | ActXDoc | .vbp |
This topic is part of a series that walks you through creating a sample ActiveX document.
To | See |
Go to the next step | Running and Debugging the ActXDoc Project |
Start from the beginning | Creating an ActiveX Document |