Computing.Net > Forums > Programming > VB 6.0 - how to add hyperlinks??

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

VB 6.0 - how to add hyperlinks??

Reply to Message Icon

Original Message
Name: allison
Date: July 23, 2003 at 08:35:57 Pacific
Subject: VB 6.0 - how to add hyperlinks??
OS: XP
CPU/Ram: ???
Comment:

I am creating a program for daycare providers in the area. I am including a seciton for the children with links to educational sites, etc.

I can not figure out how to put links on the form.

I simply want the links on the form so the user can click the link they want, and that site will open.

Please help!


Report Offensive Message For Removal


Response Number 1
Name: Chi Happens
Date: July 26, 2003 at 20:47:35 Pacific
Reply: (edit)

Put a label on the form, set it's font properties to UNDERLINE and set the FORECOLOR to blue (so it looks like a hyperlink) then put code in the ONCLICK method that is like this:

ShellExecute Handle, "OPEN", "http://www.evolutionsoftwarellc.com", "", "", SW_SHOW

at the top of the form (or module) you need to include this:
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

if it is a private module (like a form) you will need to put PRIVATE DECLARE FUNCTION instead of the PUBLIC DECLARE FUNCTION as show above.

Finally if you want to use the SW_SHOW instead of a number, put this at the top of the form:
' ShowWindow() Commands
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_NORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
Const SW_MAXIMIZE = 3
Const SW_SHOWNOACTIVATE = 4
Const SW_SHOW = 5
Const SW_MINIMIZE = 6
Const SW_SHOWMINNOACTIVE = 7
Const SW_SHOWNA = 8
Const SW_RESTORE = 9
Const SW_SHOWDEFAULT = 10
Const SW_MAX = 10

or pick and choose the ones you want.

Also it would be cool to change the mousepointer to the pointing hand.

Hope this helps.
Chi Happens


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software