DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   combobox (http://www.daniweb.com/forums/thread166103.html)

kritiohri Jan 5th, 2009 1:10 am
combobox
 
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????

Ramy Mahrous Jan 5th, 2009 1:29 am
Re: combobox
 
After assign ComboBox your datasource (your department table) navigate in ComboBox properties you'll find which help you doing your task.

manoj_582033 Jan 5th, 2009 6:58 am
Re: combobox
 
Hi You Must try this
Protected Sub DropDownList1_SelectedIndexChanged()
  con=new sqlcnnection(constr)
  adpt=new sqldataadapter("select dept_code  from T.N. where dept_name='"+dropdownlist1.selecteditem+"'",con)
  ds=new dataset
  adpt.fill(ds,"T.N.")
  dim i as string=ds.tables(0).rows(0).item(0)
  dropdownlist2.item.clear()
  dropdownlist2.item.add(i)
End Sub


All times are GMT -4. The time now is 5:32 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC