Add a hyperlink

Add a hyperlink

This is an improvement on the add hyperlink code submitted previously.  Unfortunately I was unable to find out who submitted that code and so are unable to credit them. With this version you overcome the drag shadow and can use the
link on any background colour you require.
Just remember to change the background colour on all the objects.

'To make this hyperlink look really professional
'Place the lblURL into a frame
'Re-size the frame so that it is exactly the SAME size
'as lblURL.  Then in design time, change the mouse pointer
'for the form to 3 I-Beam.  And change the MousePointer
'for the frame to 1 Arrow.
'As stated on the previous article if linking to e-mail
'then uncomment line containing mail and comment
'line below


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

Private Sub Form_Load()
With lblurl
       .ForeColor = vbBlue
       .Font.Underline = True
       End With
       
End Sub

Private Sub lblurl_Click()
With lblurl
               ' Call ShellExecute(0&, vbNullString, "Mailto:" & .Caption, vbNullString, vbNullString, vbNormalFocus)
                 Call ShellExecute(0&, vbNullString, .Caption, vbNullString, vbNullString, vbNormalFocus)
               End With
End Sub
'code submitted by dreec 19/01/01

You might also like...

Comments

 dreec

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The question of whether computers can think is just like the question of whether submarines can swim.” - Edsger W. Dijkstra