Having trouble figuring out how to set the color for specific cells in a listbox. I update the text in these cells and want to set them to a specific color after updating so that I can see that there’s been an update. I have the following code in the method that updates the text:
For k as integer = 4 to 6
DeviceList.CellType(i,k) = Listbox.TypeEditableTextField
DeviceList.EditCell(i,k)
Devicelist.ActiveCell.SelStart = 0
DeviceList.ActiveCell.SelLength = DeviceList.ActiveCell.Text.Len
DeviceList.ActiveCell.TextColor = &c0080FF00
Next
DeviceList is my listbox. This is all happening in another For/Next loop that performs the action on each row (i).
When I do this, nothing happens. The text color is still black.
Because the cellTextPaint then fires and colors the text default black. You will need to set a boolean and, if True, color the text to &c0080FF00 in the cellTextPaint evant. Calling .invalidate on the LB will then get you your colors
No. I got it. I’m using the CustomCellListbox class from either Restrepo or Ballman (forget who) and they set the forecolor to black always in the celltextpaint event of the super for my class. I just fixed it…