0

I was wondering if it was possible to bound 2 combo boxes to each other. the first combo box with a set of information. Based on what the user selects, the second combo box changes. this involves 2 tables.

table 1
ProductID
Descritption

table 2
Id
FK_ProductID
Category


example: the user selects Product in combo box 1
and the second combo box will fill product Categories based on "Product", such as "Outsourcing" or "Software Development"

2
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by dickersonka
0

yes

populate combo1 with table1
valuemember productid
displaymember description

from combo1 handle event selectedindexchanged

load selectedvalue (which needs to be productid)

the line of code is in c#, but you can see the logic

int selValue = Convert.ToInt32(this.combo1.SelectedValue.ToString());

issue query

select id, category, productid from table2 where productid = selValue;

populate combo2 with results
valuemember = id
displaymember = category

0

hi

I am Purely using VB.Net and VB.Net only , and I really aprreciate your input guys.

Can I get the code that will work using VB.Net only.

Thanks in advance
Sally

0

yes

populate combo1 with table1
valuemember productid
displaymember description

from combo1 handle event selectedindexchanged

load selectedvalue (which needs to be productid)

the line of code is in c#, but you can see the logic

int selValue = Convert.ToInt32(this.combo1.SelectedValue.ToString());

issue query

select id, category, productid from table2 where productid = selValue;

populate combo2 with results
valuemember = id
displaymember = category

hi Thanks

My problem is that I am Purely using VB.Net and VB.Net only , and I really aprreciate your input guys.

Can I get the code that will work using VB.Net only.

Thanks in advance
Sally

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.