|
-
Feb 9th, 2000, 07:00 PM
#1
Thread Starter
Lively Member
Hi,
I want to make a label on a form (in VB5) to be a web link when it's clicked on.
It works great - I've down the ShellExecute bit and and set the mouseicon property to display the link select cursor, but what I want is the label to change colour when the mouse passes over it!
Sounds simple but I can't do it 
Hope someone can help me
Simon
-
Feb 9th, 2000, 07:19 PM
#2
Frenzied Member
In the MouseMove event of the label;
Label1.ForeColor=vbBlue
In the MouseMove event of the form (or the fram if the label is inside a frame)
Label1.ForeColor=vbBlack
------------------
Mark "Buzby" Beeton
VB Developer
[email protected]
-
Feb 9th, 2000, 10:07 PM
#3
Thread Starter
Lively Member
Is this really the best way? It doesn't always change back to blue straigh away when it moves off the label back onto the form.
Simon
-
Feb 10th, 2000, 03:37 AM
#4
Hyperactive Member
That's the right code for launching the web browser but doesn't change the colours! 
Simon
-
Feb 10th, 2000, 03:55 AM
#5
Hyperactive Member
My greatest apologies Buzby - the label was in a frame and I didn't do that bit properly!
Thanks for the answers folks.
Simon
-
Feb 10th, 2000, 12:45 PM
#6
PowerPoster
You can add the following code into your label1 click events module:
Public Sub Label1_Click()
Dim Success As Long
Dim URL = "http://www.vb-world.net"
Success = ShellExecute(0&, vbNullString, URL, vbNullString, "C:\", SW_SHOWNORMAL)
End Sub
BTW, byou need to declare the following API function:
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
Public Const SW_SHOWNORMAL = 1
[This message has been edited by Chris (edited 02-10-2000).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|