CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2011
    Posts
    10

    Red face Please Help, Linking 2 Combo Boxes Together

    Hi i've been searching everywhere to try to get this setup. I am running Visual Basic 2008

    I have 1 Combo Box that Has 3 Entries, Kyocera>Konica>Toshiba

    I have a 2nd Combo Box that has entries for each of those manufactors...Kyocera has 3035,4035,5035....the konica has c250,c352,c452......the Toshiba has c3520, 4520

    I want it so when i click on Kyocera the 2nd combo box only reads 3035,4035,5035 and when i click konica it only reads c250,c352,c452 etc etc

    Thank you for your help

  2. #2
    Join Date
    Jan 2011
    Posts
    9

    Re: Please Help, Linking 2 Combo Boxes Together

    I had this problem not too long ago... If you do it my way, you need to make 2 tables in a database... I'm not sure how to do it just using raw text in comboboxes, sorry. Create one table called "Make", and another table called "Models". List the Kyocera, Konica, Toshiba, etc as rows in a field [Make] under the "Make" table and set this [make] field as the primary key. Under the "Models" table list the [Make] and [Model] fields and enter each of your makes/models in rows. Now... set a relationship between the [Make] primary key field in the "Make" table to the [Make] field in the "Models" table. It should have a one to many relationship with one being your key and many being listed in your models, get it... only one make but many models.

    If you build your relationship right, then all you have to do is make sure you choose from the same (linked)table and it will filter automatically. You can make 100 tables and as long as you keep the relationship string attached to the first [Make] field then everything down the row will change when you select that "make" in the combobox, datagrid, listbox, etc., whatever you are using to select it.

    http://msdn.microsoft.com/en-us/vbasic/ff718212

    Best tutorial videos on the web...

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

Featured