Results 1 to 4 of 4

Thread: Fill Combobox

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2003
    Location
    Lisbon - Portugal
    Posts
    30

    Fill Combobox

    Hi,

    When I load the form, I want to load all zipcode table into the cbx but I want to leave the zip code of the first client selected. And when I change client I want to change the cbx text value.

    any idea?

    thanks

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    you could use the sendessage api to find and select an item in the combo.

    VB Code:
    1. Option Explicit
    2. 'set style of combo to 2-dropdown list
    3. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
    4. Private Const CB_FINDSTRING = &H14C
    5.  
    6. Private Sub Form_Load()
    7.     Combo1.Clear
    8.     Combo1.AddItem "peet"
    9.     Combo1.AddItem "muzzi"
    10.     Combo1.AddItem "hack"
    11.     Combo1.AddItem "beachbum"
    12.     Combo1.AddItem "darre1"
    13.     Combo1.AddItem "plenderj"
    14.     Text1.Text = "muzzi"
    15. End Sub
    16.  
    17. Private Sub Text1_Change()
    18.     Combo1.ListIndex = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal CStr(Text1.Text))
    19. End Sub

    that what you are after ?
    -= a peet post =-

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2003
    Location
    Lisbon - Portugal
    Posts
    30
    Thanks a lot peet!!!

  4. #4
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    your welcome pintojoa
    -= a peet post =-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width