linking two combo boxes

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2008
Posts: 19
Reputation: Sally123 is an unknown quantity at this point 
Solved Threads: 0
Sally123 Sally123 is offline Offline
Newbie Poster

linking two combo boxes

 
0
  #1
Nov 11th, 2008
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"
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,162
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 138
dickersonka dickersonka is offline Offline
Veteran Poster

Re: linking two combo boxes

 
0
  #2
Nov 11th, 2008
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
  1. int selValue = Convert.ToInt32(this.combo1.SelectedValue.ToString());

issue query
  1. select id, category, productid from table2 where productid = selValue;

populate combo2 with results
valuemember = id
displaymember = category
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 19
Reputation: Sally123 is an unknown quantity at this point 
Solved Threads: 0
Sally123 Sally123 is offline Offline
Newbie Poster

Re: linking two combo boxes

 
0
  #3
Nov 12th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 19
Reputation: Sally123 is an unknown quantity at this point 
Solved Threads: 0
Sally123 Sally123 is offline Offline
Newbie Poster

Re: linking two combo boxes

 
0
  #4
Nov 12th, 2008
Originally Posted by dickersonka View Post
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
  1. int selValue = Convert.ToInt32(this.combo1.SelectedValue.ToString());

issue query
  1. 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
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,162
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 138
dickersonka dickersonka is offline Offline
Veteran Poster

Re: linking two combo boxes

 
0
  #5
Nov 12th, 2008
well show what you got then

then we'll go from there
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum


Views: 636 | Replies: 4
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC