943,652 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 395
  • VB.NET RSS
Jan 5th, 2009
0

combobox

Expand Post »
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????
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kritiohri is offline Offline
24 posts
since Nov 2008
Jan 5th, 2009
0

Re: combobox

After assign ComboBox your datasource (your department table) navigate in ComboBox properties you'll find which help you doing your task.
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Jan 5th, 2009
0

Re: combobox

Hi You Must try this
vbnet Syntax (Toggle Plain Text)
  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
Reputation Points: 10
Solved Threads: 2
Light Poster
manoj_582033 is offline Offline
39 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: about outlook express
Next Thread in VB.NET Forum Timeline: merging two txt files into one txt file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC