February 18th, 2010, 07:28 AM
[RESOLVED] Cannot update values to multiple rows i dataGridView
I am using Visual Studio 2010 RC, but I don't know if this problem is unique for this version of Visual Studio.
I am trying to update two values of the selected rows in a dataGridView. I've set the multiselect property to true and the selection mode property to FullRowSelect. When I select a number of rows in the DGV and click the button that fires the updating event the top most row does not get updated. But the other rows do.
Here is the method that updates the rows:
private void buttonOverfoering_Click(object sender, EventArgs e)
foreach (DataGridViewRow dr in bestillingerDataGridView.SelectedRows)
dr.Cells.Value = "Bestilt";
dr.Cells.Value = DateTime.Now;
I don't know if this is the best or right way to update values in a DGV and save them back to the database. It certainly is easy, had it only worked...
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.