Bugfix correct child_id from datagridview.

This commit is contained in:
kougyokugentou 2021-01-22 20:33:01 -08:00
parent 2786439c52
commit 5b286c4930

View File

@ -78,11 +78,11 @@ namespace GreatHomeChildcare
//PB&J: get currently selected row from dgv, then pass to GetChildByID() to get Child object. //PB&J: get currently selected row from dgv, then pass to GetChildByID() to get Child object.
private void btnUpdate_Click(object sender, EventArgs e) private void btnUpdate_Click(object sender, EventArgs e)
{ {
child_id = dgvChildren.CurrentRow.Index; /* Get the child's database ID which is secretly hidden
* in the datagrid view at column 0. Since value is an
//child_id must be incremented as the index starts at 0. * Object, cast it to Int because that's what we know it is.
//TODO: FIX BUG!! */
child_id++; child_id = (int)dgvChildren.CurrentRow.Cells[0].Value;
ShowChildCrudForm(); ShowChildCrudForm();
} }