A much simpler general solution to avoid the "renumbering" issue is to run your loop the other way:
for n = (List1.ListCount - 1) downto 0

Russ


On Apr 15, 2006, at 3:20 PM, [EMAIL PROTECTED] wrote:

have made much successful use of ListBoxes but every time I try to go =
a step further a problem occurs. This one really baffles me.=20
A window has a ListBox which allows multiple selection and a PushButton =
with the following simple code:

  for n=3D0 to (List1.listcount-1)
    if List1.selected(n) then List1.removeRow(n)
  next

When a number of rows are selected and the PushButton is pushed, the =
result is that the first row selected and other alternate rows are =
deleted and the rest are skipped.


I do that same thing but a little differently. First I write from an array to the listbox, and I store the index to the array in a celltag. Then when I see the row is selected (in the method for when user hits backspace), then I delete it from the array, not the list box. Then at the end, I clear all rows and
re-write them from the array freshly.

Another alternative is to make an array which stores all of the rows
selected, then delete them from that array.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to