RSS Forums RSS

combobox

Please support our VB.NET advertiser: DiscountASP.NET – 3 Months Free on VB.NET Web Hosting
Reply
Posts: 24
Reputation: kritiohri is an unknown quantity at this point 
Solved Threads: 0
kritiohri kritiohri is offline Offline
Newbie Poster

combobox

  #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????
AddThis Social Bookmark Button
Reply With Quote  
Posts: 1,867
Reputation: Ramy Mahrous has a spectacular aura about Ramy Mahrous has a spectacular aura about 
Solved Threads: 214
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Posting Virtuoso

Re: combobox

  #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  
Posts: 33
Reputation: manoj_582033 is an unknown quantity at this point 
Solved Threads: 0
manoj_582033 manoj_582033 is offline Offline
Light Poster

Re: combobox

  #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 8:30 am. Reason: added code tags
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Views: 246 | Replies: 2 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:25 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC