Hello
I have a form with about 100 labels and would like something to happen when I mouseover. So I have a following code:
What I would like is to do the following:
Which eventually could be made into function.
Is this possible, or maybe my approach is wrong?
I have a form with about 100 labels and would like something to happen when I mouseover. So I have a following code:
Code:
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.BackColor = vbBlue
End Sub
Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label2.BackColor = vbBlue
End Sub
...
Private Sub Label_n_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label_n.BackColor = vbBlue
End Sub
etc... 100 times
Code:
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim varLabelName as String 'or label, or control?
varLabelName = CURRENT SUB Label Name
varLabelName.BackColor = vbBlue
End Sub
Is this possible, or maybe my approach is wrong?