Step 1 - Inserting a Hypertext Link

In this first sample program a hypertext link will be inserted in a text document. The document is saved then as a HTML file so that it can be viewed in a browser.

Hypertext links are handled as a special type of a marked text field. A hypertext link therefore is inserted by calling the FieldInsert method, and then specifying the type of the field with the FieldType property:

[Visual Basic 6]
TXTextControl1.FieldInsert "Text Control Web Site"
TXTextControl1.FieldType(TXTextControl1.FieldCurrent) = _

To store the target to where the link points, the FieldTypeData property is used:

[Visual Basic 6]

The following line of code saves the document, containing the hypertext link, which has just been inserted as a HTML file in the sample folder:

[Visual Basic 6]
TXTextControl1.Save App.Path & "\step1.html", ,4 , 0

When this file is loaded with a web browser, the hypertext link will be displayed as specified in your browser's settings. Clicking on the link, will take you to the Text Control web site.

Note that there is no code for the Click events yet, so clicking on the hypertext link in the Text Control will have no effect. Also, the link is neither underlined nor colored.