Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Events for a label

Posted on 2006-11-01
6
Medium Priority
?
791 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 13

Accepted Solution

by:
jmundsack earned 1000 total points
ID: 17849603
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
ID: 17850353
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 86

Expert Comment

by:Mike Tomlinson
ID: 17850432
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17850439
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
ID: 17850472
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
ID: 17850557
DUH! I left my brain at home this morning :-(
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

721 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