WebListBox selected method only returning one item

I have a weblistbox setup with multiple row selection. This is allowing me to select multiple rows as expected.

I have tried iterating through the weblistbox using the Selected method to determine whether the row is selected or not and in all instances, I am only getting true for the very last row selected.

For example: -
In my test, I have 8 rows. If I select rows 1,3,5 and then iterate through the list box, I only get true from row 5.
If I reverse and select rows 5,3,1 and then iterate through the list box, I only get true from row 1.

SelectedRowCount appears to only be displaying the last selected row number too - rather than as it’s name would suggest, the number of selected rows.

Has anyone got this working?

Ctrl + clicking after a selection messes up the selection too. I’ve just selected 2 -4 inclusive. Then left clicked and selected 5. Only 5 is registering as selected. Looks like I need to file a bug report.

Does anyone have a suggested workaround?

Weblistbox.SelectionChanged event passes an array of integer values which are the rows selected. No need to iterate through the list.

Hi Wayne,

that was the route I originally started with. However, it’s possible to break the array. Here is how this is done: -

select row 0. shift and select row 7. 8 rows are returned in the array.

Ctrl + select row 1. Ctrl + select row 6. 2 Rows are now returned.

Ctrl + select row 5. Now, we should see Rows 0, 5 and 7 selected. We only see row 5 selected in the array.

I have just experimented further. It seems ctrl and selecting anywhere after the original selection causes the count to go wrong. So for example, I can select 0 - 4. Ctrl and select 5 to add to the previous selected rows. Visually I now have 0-5 selected. Returned array gives me (0) which contains row 5.