Comparing row between two listbox

Hi,

I am trying to compare rows between two listbox, while I do compiling, the app has no error.
its showing Out of Bound exception while I am do dragging the listbox scrollbar, but if i move it by using navigate key on keyboard, its running normal without error

I put the code in celltextpaint event,


If Listbox1.cell(row,3)=Listbox2.cell(row,0) then
  if column=3 then g.foreColor=&cFF0000
end if

any help ?

thanks
arief

Why are-you comparing Column 3 (from one ListBox) to Column 0 (the other ListBox) ?

OutOfBounds error means you tried to access a non existant Row or Column.

Also, why do you put this code in CellTextPaint ?

Paint man, not Test nor Check; Paint. These lines are not Paint related. Therefore, how many times a second this Event is Fired when you need to Compare only once.

IMHO, of course.

Okay,
thanks for the info.
will use the others option to do it

regards,
arief

A Button ?
A MenuItem ?

With a window to set the Compare start / end Row|Column ?

you could store the precomputed color in .CellTagAt
and the paint just use it.
https://documentation.xojo.com/api/deprecated/listbox.html#listbox-invalidatecell
https://documentation.xojo.com/api/user_interface/desktop/desktoplistbox.html.RefreshCell