I have a Windows.Forms.ListBox on my form. Its SelectionMode is set to MultiExtended. That allows the user use both CTRL/Click and Shift/Click to select a multiple items.
The behavior of the SelectedIndices list is inconsistant.
If the user selects n consecutive items by doing a series of CTRL/Click operations, the list will have a Count of n items and show them correctly. This allows me to walk through the list with a foreach loop.
If the user selects the same n items by doing a Shift/Click, the list will have a Count of n items, but will only allow access to the first item on the list. Trying to access the second item on the list results in an IndexOfOfRange exception. The value in the first item on the list is the index of either the first selected item or the last selected item, depending on the order the user performed the Shift/Click operations.
Have any of you delt with this, if so how?
Right now my alternative is to set SelectionMode to MultiSimple, which doesn't allow the user to use Shift/Click to grab a range.