Combo selection
-
I have a combo box with the system fonts in it, how do I get it to show a font when I start typing, ie typing ar will bring up Arial, tim will bring up Times New Roman etc
heres a snippet from a prog a wrote in vb6 Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Const CB_ERR = (-1) Public Const CB_FINDSTRING = &H14C Private Sub Combo1_Keypress(Keyascii As Integer) Dim CB As Long Dim Findstring As String If Keyascii <32 Or Keyascii > 127 Then Exit Sub If Combo1.Sellength = 0 Then Findstring = Combo1.Text & Chr$(Keyascii) Else Findstring = Left$(Combo1.Text, Combo1.Selstart) & Chr$(Keyascii) End If CB = Sendmessage(Combo1.hwnd, CB_FINDSTRING, -1, Byval Findstring) If CB <> CB_ERR Then Combo1.Listindex = CB Combo1.Selstart = Len(Findstring) Combo1.Sellength = Len(Combo1.Text) - Combo1.Selstart End If Keyascii = 0 End Sub
-
heres a snippet from a prog a wrote in vb6 Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Const CB_ERR = (-1) Public Const CB_FINDSTRING = &H14C Private Sub Combo1_Keypress(Keyascii As Integer) Dim CB As Long Dim Findstring As String If Keyascii <32 Or Keyascii > 127 Then Exit Sub If Combo1.Sellength = 0 Then Findstring = Combo1.Text & Chr$(Keyascii) Else Findstring = Left$(Combo1.Text, Combo1.Selstart) & Chr$(Keyascii) End If CB = Sendmessage(Combo1.hwnd, CB_FINDSTRING, -1, Byval Findstring) If CB <> CB_ERR Then Combo1.Listindex = CB Combo1.Selstart = Len(Findstring) Combo1.Sellength = Len(Combo1.Text) - Combo1.Selstart End If Keyascii = 0 End Sub