I have this routine that runs when the use clicks delete on a dgv row, but it keeps deleting the first row in the dgv no matter which row i have selected;
Code:
private void dgvDelays_UserDeletedRow(object sender, DataGridViewRowEventArgs e)
{
DataRowView selectedRow2 = (DataRowView)bindingDataDelays.Current;
if (selectedRow2 == null)
{
return;
}
_delayID = Convert.ToInt32(selectedRow2["DelayID"]);
DataRow[] currentRows2 = DataComponents.ShiftData.tblUnitDelays
.Select("DelayID = " + _delayID);
foreach (ShiftDataSet.tblUnitDelaysRow row in currentRows2)
{
row.Delete();
}
UpdateDelay();
}