combobox & dataset SOS!!!

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2006
Posts: 26
Reputation: gabs is an unknown quantity at this point 
Solved Threads: 1
gabs's Avatar
gabs gabs is offline Offline
Light Poster

combobox & dataset SOS!!!

 
0
  #1
Jan 11th, 2007
hey people!!

how are you all? I need some help here:
1) is there any way easyer to do this:

DataSet DS = new DataSet();
foreach (DataTable t in DS.Tables)
foreach (DataRow r in t.Rows)
foreach (DataColumn c in t.Columns)
   CBx.Items.Add(r[c]);

2) how can you order a combobox to focos on a certain Item that is already there? that is, to get the combobox to show a certain item (by code alone)

please help me!!

Gabs
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: combobox & dataset SOS!!!

 
0
  #2
Jan 11th, 2007
1) what are you trying to do? Add an option for every column in every table in your database?

2) again, what exactly are you trying to do, what have you tried? Are you trying to add all the columns and have a particular one selected when you are done?
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 91
Reputation: ses5909 is an unknown quantity at this point 
Solved Threads: 0
ses5909 ses5909 is offline Offline
Junior Poster

Re: combobox & dataset SOS!!!

 
0
  #3
Jan 11th, 2007
I was wondering the same thing campkev.

If you just want the values of a single column in all the rows, set the data source and databind it.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 8
Reputation: Aun Muhammad is an unknown quantity at this point 
Solved Threads: 1
Aun Muhammad Aun Muhammad is offline Offline
Newbie Poster

Re: combobox & dataset SOS!!!

 
0
  #4
Jan 25th, 2007
(1)

Dataset ds=new dataset();
Data Table dt=ds.tables[0];
Foreach(DataRow dr in dt.rows()){}


(2)

u can do so by using following to get some value selected in combo..
cmbo.selectedindex=0;
try it out , change index to u r requirments....
Reply With Quote Quick reply to this message  
Reply

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




Views: 4108 | Replies: 3
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC