VBForums >
.NET >
C# > [RESOLVED] [2.0] binding combobox inside in the datagrid
Click to See Complete Forum and Search --> : [RESOLVED] [2.0] binding combobox inside in the datagrid
popskie
Mar 5th, 2007, 08:46 PM
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
jmcilhinney
Mar 6th, 2007, 04:43 PM
Just like a regular ComboBox, a DataGridViewComboBoxColumn has DataSource, DisplayMember and ValueMember properties. Reading the documentation would have told you that.
popskie
Mar 6th, 2007, 08:33 PM
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
popskie
Mar 6th, 2007, 08:38 PM
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
Nevermind this, I miss this line. cb1.DataSource = dt.Tables["customers"];
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.