ComboBox "Issue"


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: ComboBox "Issue"

  1. #1
    Join Date
    Jun 2004
    Location
    Houston area
    Posts
    557

    ComboBox "Issue"

    OK, dudes and dudettes, here's the deal......

    When you create a combobox in Access, you can set the RowSource to an SQL query that returns, let's say, 2 fields. Then you set the BOUND COLUMN to whichever field you want written to the new/editted record and set the column widths to whichever field you actually want SHOWN in the combobox (say 0";1")

    (Does this make sense?)

    Like:
    SELECT DISTINCTROW [TASKNUMBERS].[Number], [TASKNUMBERS].[Name] FROM [TASKNUMBERS];
    Bound Column is 1
    Column Widths are 0";1"

    This combobox writes the NUMBER to the table but displays the NAME.

    So my question is:

    How do you do this in VB?

    Thanks EVER so much in advance!
    L
    A balanced diet is a cookie in each hand.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    VB's standard combobox has a List property, which is essentially a String array. It also has an ItemData property, which allows you to associate an Integer value with each list item. For more information, see http://www.avdf.com/aug96/art_bound.html .

    VB also includes a databound combobox control (DBCombo), which allows you to display one column from a data source, and optionally update another data source with the value of an associated column. For more information, see http://www.vb-helper.com/index_controls.html#dbcombo .
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jun 2004
    Location
    Houston area
    Posts
    557
    TYVM, Phil!
    A balanced diet is a cookie in each hand.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center