Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to place hyperlinks on a VB 6.0 form 4

Status
Not open for further replies.

allis

Technical User
Oct 16, 2002
11
US
I need to have a form in my program with a listing of hyperlinks on which the users can click and then that site will open - how do I do this?

Thank you
 
You can use the ShellExecute API i.e
Code:
Private 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
Const SW_SHOWNORMAL = 1

Private Sub Label1_Click()
ShellExecute Me.hwnd, vbNullString, "[URL unfurl="true"]http://www.tek-tips.com",[/URL] vbNullString, "C:\", SW_SHOWNORMAL
End Sub
Simply create a label for each URL and change the label caption and URL in the ShellExecute method.
 
I use a label and the following code:

Code:
Private Sub lblURL_Click()
Dim myProgram
myProgram = Shell("C:\Program Files\Internet Explorer\iexplore.exe [URL unfurl="true"]http://www.sfcc.edu",[/URL] vbMaximizedFocus)
End Sub

Bear in mind that everything from
Code:
myProgram =
to
Code:
vbMaximizedFocus)
is on one line.

tbuch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top