Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listbox Usage
Hi I have a pair of listboxes with two lists in them. The first
listbox allows for multiple selection, the second does not. The items in the second listbox are unchanging. The user selects one or more items in the first listbox and then one item in the second and this sets a pairing that is used elsewhere in the code. My problem is this. As items are selected in the first list, I remove them from the overall list by checking in reverse order (e.g. From UserForm.Listbox.ListCount - 1 to 0 Step -1) if an item was selected. If it is, I then go about a loop where every item is moved up one on the list and then the last item is set to = "". I do this in a temp array, redimming the array after its completely looped through all the items in the list, clearing the listbox and then setting it back up by setting it equal to the array. The problem is, I seem to randomly get the "" at the back end of the listbox. Its like the array isn't redimming. If I redim a 1D array to a smaller size, shouldn't it just drop all the items at the end? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listbox Usage
I suspect there is an error in the logic of the code that reorganizes the
array. This would be an easy mistake to make. Yes, redimming a 1D array to a smaller size will drop the elements off the end -- Regards, Tom Ogilvy "Marston" wrote in message om... Hi I have a pair of listboxes with two lists in them. The first listbox allows for multiple selection, the second does not. The items in the second listbox are unchanging. The user selects one or more items in the first listbox and then one item in the second and this sets a pairing that is used elsewhere in the code. My problem is this. As items are selected in the first list, I remove them from the overall list by checking in reverse order (e.g. From UserForm.Listbox.ListCount - 1 to 0 Step -1) if an item was selected. If it is, I then go about a loop where every item is moved up one on the list and then the last item is set to = "". I do this in a temp array, redimming the array after its completely looped through all the items in the list, clearing the listbox and then setting it back up by setting it equal to the array. The problem is, I seem to randomly get the "" at the back end of the listbox. Its like the array isn't redimming. If I redim a 1D array to a smaller size, shouldn't it just drop all the items at the end? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
listbox B conditional of input in Listbox A | Excel Discussion (Misc queries) | |||
Multicolumn Listbox and ordinary listbox | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming | |||
Sorting ListBox results or transposing ListBox values to other cells for sorting | Excel Programming |