G
Guest
Hi - I'm trying to remove all the items in a combobox in order to re-populate
it with different items. I thought this would be fairly simple
straightforward code, and I feel silly because I can't figure it out. Iv'e
looked all over the web and on these postings to see if there was a way to
remove all the items at once but I haven't found anything.
So I have been trying to do it using a loop
For rw = 0 To bx.ListCount - 1
bx.RemoveItem rw
Next rw
Everytime the code gets to the last item in the Combobox it gives me an
error and says that the index dosen't exist. Say for instance I have 4 items
in the box it removes indexes 0-2 just fine but when it tries to remove index
3 it says that there is no index 3. so I tried changing the code to
bx.ListCount - 2. And that works fine except the item at index 3 (that it
says dosen't exist) is the 1st item in my new Combobox!
I'm throughly fustrated. If you have any suggestions I'd gladly take them.
Thanks
it with different items. I thought this would be fairly simple
straightforward code, and I feel silly because I can't figure it out. Iv'e
looked all over the web and on these postings to see if there was a way to
remove all the items at once but I haven't found anything.
So I have been trying to do it using a loop
For rw = 0 To bx.ListCount - 1
bx.RemoveItem rw
Next rw
Everytime the code gets to the last item in the Combobox it gives me an
error and says that the index dosen't exist. Say for instance I have 4 items
in the box it removes indexes 0-2 just fine but when it tries to remove index
3 it says that there is no index 3. so I tried changing the code to
bx.ListCount - 2. And that works fine except the item at index 3 (that it
says dosen't exist) is the 1st item in my new Combobox!
I'm throughly fustrated. If you have any suggestions I'd gladly take them.
Thanks