Jason

Jason

  • NA
  • 1
  • 0

Datagridview updates back to database

May 28 2009 8:23 AM
I have a datagridview where the users are able to add, update, and delete records. I am adding a value to the last invisible column in the datagrid for relational purposes. It grabs this value from a combobox. I am having a problem where if you hit enter when adding a new record, and then click the save button, it saves the new rows but doesn't insert the value. I assume it doesn't realize the last row is there. However, if you stay in a cell and click the save button it works. I am pretty new the dgv so any help would be greatly appreciated. Thanks in advance. Here is the code: for (int x = 0; x < dgvSchool.RowCount; ++x) { dgvSchool.Rows[x].Cells[9].Value = cbxCounty.SelectedValue; } dgvSchool.EndEdit(); schoolTableAdapter.Update(this.schoolDS.School);

Answers (1)