How can you get the combo box to display data in the drop down according to what characters are typed in?
Thanks,
Jeff
Printable View
How can you get the combo box to display data in the drop down according to what characters are typed in?
Thanks,
Jeff
As you type in characters, if they match what is in the drop down box. How do you get this to happen?
anyone got any ideas?
Set the style to 2- Dropdown List and set the Sorted property equal to True.
While that may work for you, try the attached project.
Try This ..
VB Code:
Public Function FindString(partial As String, Kontrol As ComboBox) As String Dim i As Integer For i = 0 To Kontrol.ListCount If partial = UCase(Mid(Kontrol.List(i), 1, Len(partial))) Then FindString = Right(Kontrol.List(i), Len(Kontrol.List(i)) - Len(partial)) End If Next End Function Public Sub autocomplete(Kontrol As ComboBox, KeyAscii As Integer) Dim Data As String Dim Dapat As String If Kontrol.Text <> "" Then Data = Mid(Kontrol.Text, 1, Kontrol.SelStart) If Kontrol.SelLength = Len(Kontrol.Text) Then Kontrol.Text = "" If KeyAscii <> 13 And KeyAscii <> vbKeyBack Then Data = CStr(Data) + Chr(KeyAscii) Else If KeyAscii = vbKeyBack And Data <> "" Then Data = Mid(Data, 1, Len(Data) - 1) Else Exit Sub End If End If Dapat = FindString(UCase$(Data), Kontrol) Kontrol.Text = Data Kontrol.SelStart = Len(Data) Kontrol.SelText = Dapat Kontrol.SelStart = Len(Data) Kontrol.SelLength = (Len(Kontrol.Text) - Len(Data)) + 1 End Sub Private Sub Combo1_KeyPress(KeyAscii As Integer) autocomplete Combo1, KeyAscii KeyAscii = 0 End Sub