Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Combo Boxes


Combo Boxes

Author
Message
Sean Downes
Sean Downes
Forum God
Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)

Group: Forum Members
Posts: 11, Visits: 26
Hello, im trying to create a form and in my form i have 2 combo boxes. The first one is titled 'Selection' the second one is titled 'Sub'.

When a user clicks on 'Selection' and picks an item i.e 'Movies'

How do i write the coding so when the user clicks 'Movies' in 'Selection' it limits the items in 'Sub' to those connected with 'Movies'.

Cheers.

Keithuk
Keithuk
Forum God
Forum God (291K reputation)

Group: Moderators
Posts: 1.9K, Visits: 5.5K
Welcome to A1vbcode Sean.

Well I assume your getting this info from a database but there are many ways to access and database. ADO, Adodc, OLE DB, ODBC, RDS, DAO, Jet, JRO, and the old Data control. ADO, DAO, Adodc and the Data control are the common ones used which one are you using?

If the user clicks on Movies then I would assume you have a Movies table in the database so you would load the fields onto the Form. Surely there are more controls on the Form as 2 ComboBoxes won't show much. For a database you would be better of using a ListView with a column for each field.


Keith

I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Sean Downes
Sean Downes
Forum God
Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)

Group: Forum Members
Posts: 11, Visits: 26
Thanks for the reply.

Im not using any databse at all, literally just using everything from VB. All the data needed is in my program. Is it best to do so? Even though i havent and cant get access to microsoft access.

Cheers

Mark
Mark
Forum God
Forum God (139K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
So how are you storing the relation between Selection and Sub being stored? Specific examples would be nice.
Edited
6/28/2012 by Mark
Keithuk
Keithuk
Forum God
Forum God (291K reputation)

Group: Moderators
Posts: 1.9K, Visits: 5.5K
So all this data/info is built into the VB code?

So for anything the user selects in 'Selection' Combobox your using Select Case to put info into 'Movies' Combobox?

You don't need access to Microsoft Access to use a database in VB its all done through dll and tlb calls. e.g. dao360.dll, msado15.dll, msado28.tlb.

You just add these in Project\References...

Keith

I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Sean Downes
Sean Downes
Forum God
Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)Forum God (4.2K reputation)

Group: Forum Members
Posts: 11, Visits: 26
Sorry im really bad with understanding coding etc.

I havent set up the link between the two combo boxes thats what im trying to find out what i need to do.

Example:

Selection: [_______________[^]     (User clicks ComboBox1 named 'Selection' and chooses movies

> Selection: [Movies_________[^]

(when the user clicks movies, the second combobox has limited choices that relate to the items chosen in ComboBox1)

 

Selection: [Movies_________[^]

Sub: [______________[^]   -  (Combobox2 will have items like: Action, Chic Flick etc) ( If they picked hobbies in combobox1 then combobox2 will only show items that relate to hobbies i.e. sailing, climbing etc)

Keithuk
Keithuk
Forum God
Forum God (291K reputation)

Group: Moderators
Posts: 1.9K, Visits: 5.5K
Sean Downes (7/1/2012)
Sorry im really bad with understanding coding etc.

I havent set up the link between the two combo boxes thats what im trying to find out what i need to do.

If you haven't setup a link between 'Selection' Combobox and 'Movies' Combobox how do you know what has been selected in 'Selection' Combobox?

It going to be far easier to use a database to store all this info in and you can search it for specific info quickly. Depending on what you want your app to do you cound have different Tables for different subjects Movies, Hobbies, Sport, Cars etc

If you want ideas on how database apps work do a search on PSC there are 266,246 lines of database apps to check out. Just do a quick search for Movie Database.

Keith

I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search