Results 1 to 5 of 5

Thread: Combo List control

  1. #1

    Thread Starter
    Hyperactive Member divined's Avatar
    Join Date
    Aug 2004
    Location
    Thessaloniki, Greece
    Posts
    447

    Combo List control

    Hello everybody

    Can anyone point me to a link on how to use a combo list control?

    I want an unbounded combo list which will be populated from a table of a database. The combo list should be populated with a descriptive field, which the user will use to make his/her selection. When the descriptive field is selected a code field should be returned.
    Hope I didn`t baffle you guys with all the details!

    thx, in advance

    George Papadopoulos
    SteadFast!

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Loop through your rs ading items to the cbo.
    Something like this

    VB Code:
    1. Private sub command1_click()
    2.  
    3.     do while rs.eof = false
    4.         combo1.additem trim$(rs.fields(0).value) & vbnullstring
    5.         combo1.itemdata = rs.fileds(1).value 'must be a numeric value
    6.                                              '.ItemData is like a tag field on other controls.
    7.         rs.movenext
    8.     loop
    9.  
    10. end sub
    Not sure what you mean by code filed but this should get you started.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Hyperactive Member divined's Avatar
    Join Date
    Aug 2004
    Location
    Thessaloniki, Greece
    Posts
    447
    ok. thx. but what does the Trim function do? Does it trim the string to the components on screen dimensions?
    SteadFast!

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Trim removes leading and trailing blank spaces in the string.

    Highlight the word Trim in your code and press F1

  5. #5

    Thread Starter
    Hyperactive Member divined's Avatar
    Join Date
    Aug 2004
    Location
    Thessaloniki, Greece
    Posts
    447
    Is it compulsory to enter the itemdata property of the component? That is because I have no Integer field in my table. The primary key is a unique alphanumeric string I construct!
    SteadFast!

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