2
Reply

datagridview combobox c# winforms

Babin Raj M

Babin Raj M

Sep 12 2015 4:24 AM
514
sir,
      my name is Babin raj i am a btec student ,i am also working as a freelancer i have a doubt on datagridview combobox .the problem is that when i trys to set a datasource to  combobox cell dynamically the color of the combobox  dropdown list changes to black color     below is the code i have used
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
         int n = dataGridView1.CurrentCell.RowIndex;
         if (dataGridView1.CurrentCell.ColumnIndex == 0)
         {
               var cbCell = dataGridView1.Rows[n].Cells["category"] as DataGridViewComboBoxCell;  
              DataTable dt = c1.ret("select category from category").Tables[0];
               cbCell.DataSource = dt;
               cbCell.ValueMember = "category";
               cbCell.DisplayMember = "category";
               cbCell.FlatStyle = FlatStyle.System;
         }
}
 please help me i have no other source to get the answer for my question i have tryed couple of  code from  internet but the problem is not fixed  
 
 

Answers (2)