Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Combo selection

Combo selection

Scheduled Pinned Locked Moved Visual Basic
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • L Lost User

      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

      S Offline
      S Offline
      Stigmurder
      wrote on last edited by
      #2

      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

      L 1 Reply Last reply
      0
      • S Stigmurder

        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

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Cheers Stig will give it a go.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups