Hi ,
I have a datatable object and a comboxbox type field inside my datagridview name contactnameCombo created from a design time. I want to bind that combobox to a datatable field object during run time.
thanks,
popskie
Printable View
Hi ,
I have a datatable object and a comboxbox type field inside my datagridview name contactnameCombo created from a design time. I want to bind that combobox to a datatable field object during run time.
thanks,
popskie
Just like a regular ComboBox, a DataGridViewComboBoxColumn has DataSource, DisplayMember and ValueMember properties. Reading the documentation would have told you that.
Hi JM,
I came out this code but no data will came out to the combox. I include the screen capture of the output.
DataSet dt = new DataSet();
dadapter.Fill(dt, "Customers");
cb1.DataSource = dt;
cb1.ValueMember = "customerid";
cb1.DisplayMember = "ContactName";
Thanks,
Popskie
Quote:
Originally Posted by popskie
Nevermind this, I miss this line. cb1.DataSource = dt.Tables["customers"];