My datagridview itemDelete function:
this.dgv_items.RowsRemoved += this.dgv_items_itemDelete; private void dgv_items_itemDelete(object sender, DataGridViewRowsRemovedEventArgs e) { try { int row = e.RowIndex; string name = dgv_items.Rows[row].Cells[0].Value.ToString(); deleteFromDB(name); } catch (Exception) { } }
But by the time we reach this code, the line will be deleted, and the value dgv_items.Rows[row].Cells[0].Value will get the value if the line is next to the line.
I want to get the value Cells[0] deleted row, so I can also delete the item from the database file. How can I achieve this?
natli source share