combobox

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

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

combobox

 
0
  #1
Jan 5th, 2009
I have two fields in a table(dept_code and DEPT_name) in SQL.In my form iam having two comboboxs. one for dept_name and the other for Dept_code.What i want is that when i select a particular dept_name from the combobox its associated dept_code should come in the other combobox????
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: combobox

 
0
  #2
Jan 5th, 2009
After assign ComboBox your datasource (your department table) navigate in ComboBox properties you'll find which help you doing your task.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 34
Reputation: manoj_582033 is an unknown quantity at this point 
Solved Threads: 0
manoj_582033 manoj_582033 is offline Offline
Light Poster

Re: combobox

 
0
  #3
Jan 5th, 2009
Hi You Must try this
  1. Protected Sub DropDownList1_SelectedIndexChanged()
  2. con=new sqlcnnection(constr)
  3. adpt=new sqldataadapter("select dept_code from T.N. where dept_name='"+dropdownlist1.selecteditem+"'",con)
  4. ds=new dataset
  5. adpt.fill(ds,"T.N.")
  6. dim i as string=ds.tables(0).rows(0).item(0)
  7. dropdownlist2.item.clear()
  8. dropdownlist2.item.add(i)
  9. End Sub
Last edited by Narue; Jan 5th, 2009 at 9:30 am. Reason: added code tags
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC