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

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?

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.

(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....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.