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!

How can I color highlite one line of a listbox or textbox?

Status
Not open for further replies.

tedsmith

Programmer
Nov 23, 2000
1,762
0
0
AU
How can I make any one line of a listbox, textbox or datagrid a different color to the other lines? Similar to the highkiting you get whe you select a line in a list box but not related to where you click the mouse position.
 
A textbox and a listbox can only have one color and one type of font in them. Use a RichTextBox, highlight the text to be changed and use its SelFontName, SelColor, SelUnderline, SelBold, SelItalic, etc. properties.

I know in a MSHFlexGrid you can change the colors and fonts. Here's an example of code to do this (hfg is the MSHFlexGrid):

For x = 0 To hfg.Cols - 1
hfg.Col = x
hfg.Row = 'Row you want to change the color of
hfg.CellBackColor = 'color you want to change it to
Next x
 
You vcould make a line look different by forcing the mouse select on that line (reverse background)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top