ComboBox Data Bindings

Psygnus

Newcomer
Joined
Jul 25, 2005
Messages
6
Hello everybody i would like some help for the following issue:

I want to populate a ComboBox with values from an Access DB Table everytime it initializes.
I 've done all the connections right(datasets,adapters etc...).
I have written the following code which i got from the .NET Help but it doesn't work:

this->comboBox1->DataSource = this->dataSet41->Clientz;
this->comboBox1->DisplayMember = S"Name";

There are no errors but no results too!
Please Help

Thanks in advance
 
Does the table actually have rows in it? What is "Clientz"? Is the column name "Name" correct (is it actually "name")?

The following works just fine for me:
Code:
DataTable *dt = new DataTable();

sqlDataAdapter1->Fill(dt);

comboBox1->DataSource=dt;
comboBox1->DisplayMember="Name";
comboBox1->ValueMember = "ID";
 
Last edited:
Oh..!
I never thought of using a DataTable!

I thought that creating a dataSet can be a way to access directly database fields. But now i understand that it's only used to avoid writing all the update statements on your own. Or not!!!?? :confused:

The point is that it's working just fine now!! :) :)
THANKS A LOT!
 
Back
Top