use a function to change de backcolor of a lable

Jordan2000

Registered User.
Local time
Today, 18:10
Joined
Nov 4, 2004
Messages
24
I am trying to make a module. that wil change the collor of any lable that is been selected with the mouse.


Public Function lblBackcollor(optie As String)
Dim hoverColor, leaveColor As Long
hoverColor = RGB(255, 255, 0)
leaveColor = "12632256"


If optie = "1" Then
hoverColor
ElseIf optie = "2" Then
leaveColor
Else
End If

End Function

te function is been called like
lblinformation.backcolor = lblBackcollor("1")

it dont work can anyone help.
 
you almost have it:

If optie = "1" Then
me.label.backcolor=hoverColor
ElseIf optie = "2" Then
me.label.backcolor=leaveColor
Else
End If

Note for A2K and upward, there's a Conditional Formatting on the forms(?) toolbar which let you easily change fore and backcolor based upon a calculation or mere focus. Check it out.

I use that programmatically to set the background color of each (textbox and combobox) control when it get focus, so user can tell immediately where focus is. I also use red/pink background for negative numbers. I build all that programmatically for each for rather than for one control at a time.

Just something for you to think about.
 

Users who are viewing this thread

Back
Top Bottom