Ich denke die Methode ist selbsterklärend.
VB.NET-Quellcode
- Private Function SearchListBox(ByVal lListBox As ListBox, ByVal sSearchString As String, ByVal bCase_Sensitive As Boolean)
- For i As Integer = 0 To lListBox.Items.Count - 1
- If bCase_Sensitive = False Then
- If lListBox.Items.Item(i).ToUpper.Contains(sSearchString.ToUpper) Then
- lListBox.SelectedIndex = i
- End If
- Else
- If lListBox.Items.Item(i).Contains(sSearchString) Then
- lListBox.SelectedIndex = i
- End If
- End If
- Next
- End Function