This example shows how to read entries from a ListBox and reference an array which contains numeric values corresponding to the selection.  This is useful if you want to do logic AND statements with the selection from the ListBox.

I used this method to assign numeric tags to the ListBox items.  This allowed me to assign a unique value to each combination of selections made.

Public Class Form1
 Dim arrTag(2, 5) As String, arrTagMax As Integer

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
 LoadArray()
 End Sub

Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lstACLGroups.SelectedIndexChanged
 Dim txt As String = ""
 Dim acc As Integer = 0

For i = 0 To lstACLGroups.SelectedItems.Count - 1
 txt += lstACLGroups.SelectedItems(i).ToString & vbCrLf

For j = 1 To 5
 If lstACLGroups.SelectedItems(i).ToString = arrTag(2, j) Then
 acc = acc + CInt(arrTag(1, j))
 End If
 Next
 Next

 TextBox1.Text = txt
 TextBox2.Text = acc.ToString
 End Sub

Sub LoadArray()
 Dim i As Integer

arrTag(1, 1) = 1
arrTag(2, 1) = "1 apple"

arrTag(1, 2) = 2
arrTag(2, 2) = "2 banana"

arrTag(1, 3) = 4
arrTag(2, 3) = "4 coconut"

arrTag(1, 4) = 8
arrTag(2, 4) = "8 dog"

arrTag(1, 5) = 16
arrTag(2, 5) = "16 elephant"

lstACLGroups.Items.Clear()
 For i = 1 To 5
   lstACLGroups.Items.Add(arrTag(2, i))
 Next

End Sub
End Class