Private Sub InitializeMyListBox()
listBox1.Items.Add("A")
listBox1.Items.Add("C")
listBox1.Items.Add("E")
listBox1.Items.Add("F")
listBox1.Items.Add("G")
listBox1.Items.Add("D")
listBox1.Items.Add("B")
listBox1.Sorted = True
listBox1.SelectionMode = SelectionMode.MultiExtended
listBox1.SetSelected(0, True)
listBox1.SetSelected(2, True)
listBox1.SetSelected(4, True)
listBox1.TopIndex = 0
End Sub
Private Sub InvertMySelection()
Dim x As Integer
For x = 0 To listBox1.Items.Count - 1
If listBox1.GetSelected(x) = True Then
listBox1.SetSelected(x, False)
Else
listBox1.SetSelected(x, True)
End If
Next x
listBox1.TopIndex = 0
End Sub