Im a trying to write a function which will change the colour of a label on mose moves. the sample code i have written is
Public Function funMouseBehaviour(strName As String, strAction As String)
Select Case strAction
Case "Down", "Up"
For Each ctl In Me.Controls
If strName = ctl.Name Then
Select Case strAction
Case "Down"
ctl.BorderStyle = 0
ctl.ForeColor = 16711680
Case "UP"
ctl.BorderStyle = 5
ctl.ForeColor = 16711680
End Select
End If
Next ctl
End Select
I want to call the function like so
Private Sub Label0_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
X = funMouseBehaviour("label10", "UP")
End Sub
I cant get it to work.
Can anyone please help show me where im going wrong
Much appreciated
Public Function funMouseBehaviour(strName As String, strAction As String)
Select Case strAction
Case "Down", "Up"
For Each ctl In Me.Controls
If strName = ctl.Name Then
Select Case strAction
Case "Down"
ctl.BorderStyle = 0
ctl.ForeColor = 16711680
Case "UP"
ctl.BorderStyle = 5
ctl.ForeColor = 16711680
End Select
End If
Next ctl
End Select
I want to call the function like so
Private Sub Label0_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
X = funMouseBehaviour("label10", "UP")
End Sub
I cant get it to work.
Can anyone please help show me where im going wrong
Much appreciated