dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: populating combo boxes

  1. #1
    Join Date
    Feb 2004
    Location
    Manchester
    Posts
    2

    populating combo boxes

    Hi
    i have 2 combo boxes 1 named cmbtown the other cmbmovies.
    i also have a table named town and a seperate table for each town (e.g. manchester, london ) which has all the movies listed. i have a data control linked to the table town and 1 linked to each of the the other tables.

    i am trying to get it so when i select a town (e.g. manchester) in combo1, combo2 lists all the movies available in that town.

    if anyone can help plz post up.

    cheers

    jamie
    Jamie

    E-mail - zen17120@zen.co.uk
    Msn - finland11@hotmail.com
    Fastpay - Zen17120@zen.co.uk

  2. #2
    Join Date
    Aug 2003
    Location
    Buenos Aires, Argentina
    Posts
    513
    Which is the control, Data Access Object or ADO Data Control?

    I would suggest another structure of tables:

    I table called Towns, with all the towns, having two fields: Town_ID and Town_Name

    I table called Movies, having 2 fields: Movie_ID and Movie_Name

    Then a third table, Relations, having 2 fields:
    Town_ID and Movie_ID.

    For example:

    London has Rocky 1 and Rocky 2

    In table Towns, London's ID is 12
    In table Movies, Rocky 1's ID is 3 and Rocky 2's ID is 4

    Then in table Relations, you have:
    Town_ID Movie_ID
    12 3
    12 4

    In VB, you use your data objects to populate combos. If you don't know how to do this, tell us which control you use and we'll help you.

    Bye !

  3. #3
    Join Date
    Jan 2003
    Location
    7,107 Islands
    Posts
    2,487
    Yeah I agree with vbUserName for the redesigning of the database.. If you are going to use the ADO data access, a close open connection object will do just fine.. It seems to me that the combo1 (town) will be loaded with the records once, and the combo2(movies) will eventually be loaded with records in respond to the Click event of combo1..
    Busy

  4. #4
    Join Date
    Dec 2003
    Location
    Bulgaria
    Posts
    106

    Lightbulb

    You could use a list view instead of the second combobox (with the movies) to present the result of the user's clicking of the first combobox (with the towns) ...

    Good luck!
    B. Mileva

  5. #5
    Join Date
    Feb 2004
    Location
    Manchester
    Posts
    2
    Hi
    The controls are Data Access Object.
    ill just re design my Database now.

    cheers

    Jamie
    Jamie

    E-mail - zen17120@zen.co.uk
    Msn - finland11@hotmail.com
    Fastpay - Zen17120@zen.co.uk

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)