Bold or colour for an individual word in a listbox for VBA/VB6
Posted on 2007-03-26
I have a form with a listbox that uses the standard VBA listbox control.
Private Sub UserForm_Initialize()
ListBox1.ListStyle = 1
ListBox1.MultiSelect = fmMultiSelectSingle
ListBox1.AddItem "I want to highlight the 6 numbers"
ListBox1.AddItem "Perhaps 1 could use bold for digits "
ListBox1.AddItem "I want 2 know if you could use a colour as well"
ListBox1.Selected(0) = True
ListBox1.ListIndex = -1
This gives three lines of text in the listbox and a set of radio buttons to choose between them.
The text appears in regular, sans serif typeface. Which is what I want. However, I really want to put one word in bold / different colour in each line. In this case, I want to highlight the digits, ie "6" in the first line, "1" in the second line or "2" in the third line.
The only way to do that with the standard control seems to be placing "*" around either side of the word. But that looks bad. It really needs to be bold or italics or colour or something to really bring that individual word away from the rest of the sentence.
Is there any way to do this? Is there any other kind of control for VBA / VB6 where I can keep my list and the radio buttons and also have the highlight of an individaul word in the sentence?
Thanks in advance,