|
-
Mar 5th, 2007, 09:46 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2.0] binding combobox inside in the datagrid
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
-
Mar 6th, 2007, 05:43 PM
#2
Re: [2.0] binding combobox inside in the datagrid
Just like a regular ComboBox, a DataGridViewComboBoxColumn has DataSource, DisplayMember and ValueMember properties. Reading the documentation would have told you that.
-
Mar 6th, 2007, 09:33 PM
#3
Thread Starter
Fanatic Member
Re: [2.0] binding combobox inside in the datagrid
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
Last edited by popskie; Mar 22nd, 2007 at 02:21 AM.
-
Mar 6th, 2007, 09:38 PM
#4
Thread Starter
Fanatic Member
Re: [2.0] binding combobox inside in the datagrid
 Originally Posted by popskie
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"];
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|