Listbox problem uncoloring rows

Hello, I have a listbox that when I click on a row it changes the background color of the row to a custom color. The problem is when I click on another row to select it, the previous row does not change back to the original white on black. I thought I was handling this properly in CellBackgroundPaint but apparently not. I have read through the forums and have not been able to get anywhere. I would appreciate any help on this as I am stumped. Thanks …

CellClick event
pRow = row

CellBackgroundPaint event

if pRow = lstBudget.Listindex then
g.ForeColor = &cCCCBEC
g.ForeColor = &cFFFFFF
end if

g.FillRect(0,0,me.Width, me.Height)

Return True

CellTextPaint event

g.ForeColor = &c000000

you probably are handling it in the Paint event… but what you are probably NOT doing is telling it to redraw the cell.
Just because you chose a new cell does not invalidate the previous cell

Listindex is the CURRENT row number, but it would be up to you to remember what the last row # was and to invalidate it

I realized that I didn’t need to store the selected row in thecell click event since row is in CellBackgroundPaint. When I used row instead of pRow to compare on, it worked perfectly. Thanks for replying Dave. I should have stuck with it a little longer!