| | |
linking two combo boxes
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2008
Posts: 19
Reputation:
Solved Threads: 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"
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"
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 138
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
issue query
populate combo2 with results
valuemember = id
displaymember = category
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
VB.NET Syntax (Toggle Plain Text)
int selValue = Convert.ToInt32(this.combo1.SelectedValue.ToString());
issue query
VB.NET Syntax (Toggle Plain Text)
select id, category, productid from table2 where productid = selValue;
populate combo2 with results
valuemember = id
displaymember = category
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
•
•
Join Date: Nov 2008
Posts: 19
Reputation:
Solved Threads: 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
VB.NET Syntax (Toggle Plain Text)
int selValue = Convert.ToInt32(this.combo1.SelectedValue.ToString());
issue query
VB.NET Syntax (Toggle Plain Text)
select id, category, productid from table2 where productid = selValue;
populate combo2 with results
valuemember = id
displaymember = category
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
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 138
well show what you got then
then we'll go from there
then we'll go from there
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
![]() |
Similar Threads
Other Threads in the VB.NET Forum
- Previous Thread: Sql Query
- Next Thread: textchanged event help
Views: 636 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2008 access advanced application array basic beginner browser button buttons center class click client code combo convert cuesent data database datagrid datagridview date datetimepicker design designer dissertation dissertations dissertationtopic eclipse excel exists fade filter forms function html images lib listview map mobile module msaccess net number objects open panel pdf picturebox picturebox2 port position print printing problem read refresh regex richtextbox right-to-left save search serial settings shutdown socket sorting sqldatbase sqlserver studio temperature textbox timer timespan transparency txttoxmlconverter usercontol validation vb vb.net vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms winsock wpf wrapingcode xml year






