### Get Item List Index

Example of getting the list index for an item. Search is not case sensitive.
Returns -1 if item not found.
`Sub GetListItemIndex(l As List, Item As String) As Int
Dim Result As Int = -1
If Item.Length = 0 Then Return Result
For i = 0 To l.Size - 1
Dim s As String = l.Get(i)
If s.ToLowerCase = Item.ToLowerCase Then
Result = i
Exit
End If
Next
Return Result
End Sub`
Examples
Get the index of a COM port using the jSerial Library.
Private sp As Serial
Private cbCOMPorts As ComboBox
cbCOMPorts.Items.AddAll(sp.ListPorts)
cbCOMPorts.SelectedIndex = GetListItemIndex(sp.ListPorts, "COM3")

Changed: , Category: Lists, File: T6C215M1569.htm, ID: 1569