Deleting Elements of an Array

DonnaF

Active member
Joined
Mar 20, 2003
Messages
30
I am creating a listbox from an array. The user wants to be able to key a number in a textbox to designate which item to delete from the listbox and from the array. I can recreate the listbox, deleting the necessary item. For the array, however, I want to delete the item, and bump up the index for the remaining items in the array behind it. Each time the button is clicked, the array should be decreased by the number entered in the textbox. Each time the array will get smaller and smaller. Does anyone have any suggestions on how to easily do this. I know I can use REDIM, but do I need to write a temporary array, delete the items, and then write it back to the original array, using the REDIM?

Thanks, Donna
 
Have you considered using a one of the collection classes instead of an array?
ArrayList behaves like an array but also has methods lik RemoveAt which sound like the kind of thing youre after.
 
Back
Top