I hit my head about it with the rest, and finally developed my own function for Inverting. Here's the answer from VB.Net:
Private Function InvertListBoxSelections(ByRef tempListBox As ListBox) As Integer
Dim selectedind(tempListBox.SelectedItems.Count) As Integer
Try
For selind = 0 To tempListBox.SelectedItems.Count - 1
selectedind.SetValue(tempListBox.Items.IndexOf(tempListBox.SelectedItems(selind)), selind)
Next
tempListBox.ClearSelected()
For listitemIndex = 0 To tempListBox.Items.Count
If Array.IndexOf(selectedind, listitemIndex) < 0 Then
tempListBox.SetSelected(listitemIndex, True)
End If
Next
Return 1
Catch ex As Exception
Return 0
End Try
End Function
source
share