CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009

    Basic combo boxes

    hi there,

    i am adding a combox box to a visual basic application.
    currently im using the .additem("somestring") method, but i was wondering if there is a way to add a

    value and a number. (like in web programming) ie if the combox box is populated by a database can it

    have the an index value (thats not displayed) that is the id in the database and the actual display

    value as the string which the ID corresponds to.
    the databse contains
    ID Town
    1 Sydney
    2 Canberra

    I want the list to display Sydney and Canberra, but when i retrieve what value was selected im only

    interested in the ID, ie 1 and 2.
    I would also like to carry this behaviour to checkboxes.

    Can anyone shed some light on this?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2000
    Saskatchewan, Canada

    Re: Basic combo boxes

    combo1.additem "Sidney"
    combo1.itemdata(combo1.newindex) = 1

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)