nolc
May 30th, 2003, 11:24 AM
Does anyone know how to loop through a combobox to find an item's text and once it is found...select it? My code below is not working....thanks in advance!
Public Sub FindCboItem(ByVal text As String, ByRef cbo As ComboBox)
Dim i As Integer
MsgBox(cbo.Items.Count)
For i = 0 To cbo.Items.Count - 1
MsgBox(cbo.Items.Item(i).ToString & " = " & text)
If cbo.Items.Item(i).GetType.ToString = text Then
cbo.SelectedItem = cbo.Items.Item(i)
Exit For
End If
Next
End Sub
Public Sub FindCboItem(ByVal text As String, ByRef cbo As ComboBox)
Dim i As Integer
MsgBox(cbo.Items.Count)
For i = 0 To cbo.Items.Count - 1
MsgBox(cbo.Items.Item(i).ToString & " = " & text)
If cbo.Items.Item(i).GetType.ToString = text Then
cbo.SelectedItem = cbo.Items.Item(i)
Exit For
End If
Next
End Sub