newbie combo box question

L

LarryMac

I've got what I'm sure is an easy combo box question (I'm running
..Net, by the way). I'm trying to create a combo box that will select
and input the matching list entry as the user types. I've done it
with a text box and a list box, but it doesn't seem to work in a combo
box. What am I missing? Here's the code:

Private Sub cboAuthor_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles cboAuthor.SelectedIndexChanged
'Selects author from dropdown list

'Declare variables
Dim intListIndex As Integer = 0
Dim blnFound As Boolean = False
Dim strListEntry As String 'dropdown entries
Dim strTextEntry As String 'user entry

Do Until blnFound = True Or intListIndex =
cboAuthor.Items.Count
strListEntry = CStr(cboAuthor.Items(intListIndex))
strListEntry = strListEntry.ToUpper()
strTextEntry = cboAuthor.Text.ToUpper()
If strListEntry.StartsWith(strTextEntry) Then
cboAuthor.SelectedIndex = intListIndex
cboAuthor.Text = CStr(cboAuthor.SelectedItem)
blnFound = True
End If
intListIndex += 1
Loop

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top