listbox reorder question

Hi there - I know it’s relatively easy to set rows in a listbox to reorder them…

Is there any way to get around the “Change” event when you re-order them?
It’s throwing up a nasty error in my code…
Cheers,
Sean

1 Like

What line causes the error?
Almost certainly you need to change the code to be more defensive.
Maybe add something to the rowtag of each row so that wherever it ends up, you know which line it originally was, or which db record it refers to

1 Like

OutOfBoundsError ?

Usually that is caused by trying to address a row that does not exist.
Usually in a paint event, or cellbackgroundpaint etc

The listbox has .listcount rows
You need to check that the row you are ‘looking at’ actually exists with a value of less than the rowcount

eg you have 6 rows
They are rows 0…5

If you get an event which passes row = 6 (or row > 5) then you should immediately exit the event.
Does that help?

1 Like

I worked around and used a checkbox to allow reordering
.
If it’s off then it exits the cell action at the start. It’s a bit rudimentary, but it works!

1 Like