Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apply different colours to combo box words?

Status
Not open for further replies.

sodabunny

Technical User
Mar 31, 2003
17
0
0
GB
Hi all,

Is there a way to apply different colours to various words in a combo box and when a word is clicked then change it to another colour.

Any help would be appreciated.

Sodabunny

 
You could write a Select Case statement to set the forecolor of the combobox, and then run the code from the After_Update or On-Change event. This would set the font to the chosen colour based on the word selected from the list.

I don't know of any way to change the colour of the elements in the combobox list before one is selected.

HTH
Lightning
 
Thanks Lightning for the advice but I'm sure there is a way. What I'm trying to achieve is a notification for users to prioritise an event with colours for individual clients on our database so that it is immediately and visually apparent what their status is. Maybe there is another approach I could take. Any suggestions??

Sodabunny
 
I use the following code for a combo box that displays the status of a yes/no field in either red or black. It can be expanded to cover a value list. Good luck.

Private Sub cmbDistroyed_AfterUpdate()
If Me!cmbDistroyed = 0 Then
Me!cmbDistroyed.ForeColor = 0
Else
Me!cmbDistroyed.ForeColor = 255
End If

End Sub
 
Thanks Coljep,

Ive amended it a bit so the form forecolor changes but otherwise this is an ideal alternative.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top