View Single Post
  #1 (permalink)  
Old November 1st, 2004, 04:47 PM
ja8261 ja8261 is offline
Authorized User
 
Join Date: Aug 2004
Location: OKC, OK, USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change color of text in a listbox?

How do you change the color of text in a listbox based upon a certain criteria? For example, as my code executes it will display either "Active" or "Inactive" in the listbox. I want "Active" to be a bold green and "Inactive" to be a bold red. Is there a simple way to do this? The "Active" and "Inactive" will be displayed in the listbox at the same time so I don't want to just change the ForeColors.

I was heading towards the idea of creating a simple function that will return "Active" in bold green or "Inactive" in bold red based upon a test condition I create.

Public Function ColoredText()
     If status = "Active" then
          ' code to create a variable that would store "Active" as bold green text
     Else
          ' code to create a variable that would store "Inactive" as bold red text
     end if
end function


Jeff Armstrong
Sr. Systems Mgr
SBC Services, Inc.
__________________
Jeff Armstrong
Sr. Systems Mgr
SBC Services, Inc.