Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

VB .NET - Learn Visual Basic .NET

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 14

Using the Hyperlink Object With Internet-Aware Containers

The main purpose of Active Documents is to provide an interface within a browser-type application such as Internet Explorer or Office Binder. It should come as no surprise to you, therefore, that Active Documents support the Hyperlink object. The Hyperlink object enables you to easily jump between documents in an Internet-aware browser application.

The Hyperlink object is a property of the UserDocument and UserControl that has its own methods:

  • NavigateTo method. This method requires one argument, which is the address of another document to which the container will jump. You can provide the URL of a Web Page or of a local document that the container application can open as an Active Document.

  • GoBack method. This method requires no arguments. It causes the container application to navigate to the previous site in its history list. If this document is the first site in the history list, then GoBack has no effect.

  • GoForward method. This method requires no arguments. It causes the container application to navigate to the next site in its history list. If this document is the last site in the history list, then GoForward has no effect.

The functionality of these methods corresponds to the familiar Go, Forward, and Back functionality of popular Web Browser software such as Internet Explorer or Netscape's Navigator. As the following code snippet illustrates, the Hyperlink object's NavigateTo method takes a URL as its argument:

Hyperlink.NavigateTo "http://www.freetutes.com"

When you supply a URL in the String argument to Hyperlink.NavigateTo, you must specify the full Internet path including the protocol at the beginning of the string.

Correct way:

UserDocument.Hyperlink.NavigateTo _
"http://www.freetutes.com"

Wrong way:

UserDocument.Hyperlink.NavigateTo _
"www.freetutes.com"

The second format will cause a runtime error.

Also note that if you use the Hyperlink object when your document is sited in a container that isn't Internet-aware, then the user's system will attempt to load the default Internet browser application.


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved