Cascading ComboBoxes

tbpowers

Active member
Joined
Dec 12, 2011
Messages
41
Programming Experience
Beginner
I have a combobox bound to a stored procedure, which writes the Selected Value to a table in my database. Works great! Now I want to populate another combobox based on the selection in the first combobox. In order to do so, it will have to filter based off a sub_category_id related to the Selected Value in my first combobox. I have the logic worked out in SQL, just need help making it work in VB.Net. I do not really want to code in a pass through query. I would rather somehow pass the sub_category_id to a stored procedure as its paramenter. Any ideas on how I can make this work?

Example Table:
CATEGORY IDSUB CATEGORY IDVALUELABEL
PCATCENFCENTRIFUGAL_FANCentrifugal Fan
CONDCONDENSERCondenser


SELECT LOOKUP_CATEGORY, VALUE, LABEL
FROM REPAIR_LOOKUP
WHERE LOOKUP_CATEGORY = (SELECT SUB_CATEGORY_ID
FROM REPAIR_LOOKUP
WHERE VALUE = ComboBox1.SelectedValue)
AND ACTIVE = 'Y'
ORDER BY LABEL ASC
 
Well I thought I had it, but I am still having issues. I split up the master table into several lookup tables and created relationships between each table, although they are not foreign key relations. On the binding source of each table I set the DataSource as the parent lookup table and set the DataMember to the relationship I created. It still does not cascade through each level. Any ideas what I am still missing?
 
I have everything working with the exception that when viewing existing records it does not show what is saved in the table. Any further help will be greatly appreciated!
 
Back
Top