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 do i create a visual basic hyperlink in my VB interface

Status
Not open for further replies.

latanf

Programmer
Apr 10, 2003
1
US
I'm having a hard time creating a web LINK on my VB interface. how can i accomplish this? please help
 
I use a Label control with caption formatted blue and underlined. Find an icon that looks like a "hand" and set the MousePointer property to it. This code will open the url in the label caption in the default browser:

Code:
Private Sub lblURL_Click()

    Dim lngRtn As Long
    
    On Error GoTo ErrTrap
    
    lngRtn = Shell("rundll32.exe url.dll,FileProtocolHandler [URL unfurl="true"]http://"[/URL] & lblURL.Caption)
    
    GoTo ExitSub
    
ErrTrap:
    'General handler
    MsgBox "Error " & Format$(Err.Number, "#0") & " - message: " & _
    Err.Description & "." & vbCrLf & "Raised by object: " & Err.Source & ".", _
    vbCritical + vbOKOnly, "System Error"
    Resume ExitSub
    
ExitSub:
    
End Sub

Paul Bent
Northwind IT System
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top