Datagrid current row number is the same as the dataset row number?

Datagrid current row number is the same as the dataset row number?

Post by QWxwaG » Sat, 22 Oct 2005 03:29:07


I'm working on a Window based application. I have 2 textboxes and a datagrid
on a form. The textboxes are databind to the same datasource as datagrid. I
want to use the following to update the dataset but I am not suer if the
datagrid's current row number does corresponds to the row number in the
dataset table that I want to update. Appreciate it if someone can give me
answer to this.
Thanks, Alpha

private void txtLastOdometer_Validated(object sender, System.EventArgs e)

dsMaintDued.Tables["MaintenanceDued"].Rows[dgMaintDued.CurrentRowIndex]["LastOdometerReading"] = txtLastOdometer.Text.ToString();
}

private void dtpLastService_Validated(object sender, System.EventArgs e)

dsMaintDued.Tables["MaintenanceDued"].Rows[dgMaintDued.CurrentRowIndex]["LastOdometerDate"] = dtpLastService.Value.ToString();
}