Cell or row background color

i have the simple bellow code, and i try to learn the listbox.
can anyone tell me how i make the cell or the row background Red,when the cellvalue contain the error world ?

[code]Dim CellName as String
Dim CellValue as text

for c as integer =0 to lstB1.ListCount -1

CellName = lstB1.Cell(c,0)
CellValue = CellName.ToText
if CellValue.BeginsWith ("error:") then
  txterrors.Text =txterrors.Text =CellValue
  lstB1.RowTag(c) = "error"
end if

next[/code]

This is covered in a number of other threads on the forum, just search on “ListBox color” and you should see plenty of reading material.

Add one more line to the above code, at the end:

lstB1.InvalidateCell(-1,-1)

That will cause the listbox to redraw its contents.

Then in the CellBackgroundPaint event of lstB1, put

if Row < me.ListCount then
   if me.RowTag(Row) = "error" then
      g.ForeColor = &cFF0000
      g.FillRect(0,0,g.width,g.height)
      return true
   end if
end if