Solved

Events for a label

Posted on 2006-11-01
6
777 Views
Last Modified: 2013-12-25
I want to have a VB6 label control function like a hyperlink. When the user moves the mouse over the lavbel, I want to change the mouse pointer. When they click on it, I will, in code, direct them to a page in a browser. When the user moves the mouse pointer out from over the label, I want to change the pointer back to the default.

Unfortunately, the label control only has a mousemove event (I can use that to determine when the control gets focus) but no way of determining when focus is lost. Any ideas???

Doug
0
Comment
Question by:dbbishop
6 Comments
 
LVL 13

Accepted Solution

by:
jmundsack earned 250 total points
Comment Utility
Why not just set the MousePointer property of the label to "99 - Custom" and set the MouseIcon property to a "pointing finger" cursor (available in the common graphics for Visual Studio)?
0
 
LVL 15

Author Comment

by:dbbishop
Comment Utility
I can do that on MouseMove event because then I know the label has focus. But, I want to change it back to the default pointer when the label loses focus. There is no event that I am aware of that lets me know when that happens. If I move off the control, I just never call the mousemove event again. The only other option I know off is to use the mouse move events of the other controls around the label to reset the pointer to normal. I would rather do it all within the label control iteslf.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
You only need to set the properties jmundsack describes at design time. the mouse pointer will change automatically, no need to code anything.
0
 
LVL 17

Expert Comment

by:vb_elmar
Comment Utility
Needs :
=====
1 Label


Const URL = "whatismyip.com"

Private Sub Form_Load()
    With Label1
        .Font = "arial"
        .FontSize = 12
        .FontUnderline = True
        .Caption = URL
        .Width = 2000
    End With
End Sub



Public Sub gotoweb(ByVal myURL As String)
Dim Success As Long
Shell "C:\Programme\Internet Explorer\IEXPLORE.EXE " & myURL, vbNormalFocus
End Sub



Private Sub Label1_Click()
    gotoweb URL
End Sub
0
 
LVL 15

Author Comment

by:dbbishop
Comment Utility
DUH! I left my brain at home this morning :-(
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now