0

I have one datagridview with combo-box and check box. DataGRidView

when i try to get values from datagridview in data table it works fine. But when i tried to get value from database in same scheme of datagridview it adds rows in datagridview but does not sets combo box or check box value. For setting datasource i tried.

DataTable dt = db.getSecurityCheck(dateTimePickerDate.Value); dataGridView1.DataSource = null; dataGridView1.DataSource = dt;

After setting datasource and DataPropertyName with datatable column name it replaces checkbox and combobox with textboxes. After Setting Datasource.

Do i need to manually set the values by running for each loop on retrieved datatable and setting value for each cell individually.

Hot Cool Stud
  • 1,145
  • 6
  • 25
  • 50

1 Answers1

0

You need to set DataPropertyName on the columns in the DataGridView you have defined to correspond to the DataTable columns.

Zer0
  • 7,191
  • 1
  • 20
  • 34