private void ModifyTrainRecord(DataGridViewRow dgvr) { frmRecord fr = new frmRecord(dgvr.Tag as TrainRecord); fr.Text = "修改培训记录"; if (fr.ShowDialog(this) == DialogResult.OK) { UpdateRecordDataRow(dgvr, fr.EditedRecord); if (rbSaveNow.Checked) { SaveRecord2Local(fr.EditedRecord); } } }
private void btnNewRecord_Click(object sender, EventArgs e) { frmRecord fr = new frmRecord(null); fr.Text = "新建培训记录"; if (fr.ShowDialog(this) == DialogResult.OK) { dgvRecords.ClearSelection(); DataGridViewRow dgvr = CreateRecordDataRow(fr.EditedRecord); dgvRecords.Rows.Add(dgvr); dgvr.Selected = true; dgvRecords.CurrentCell = dgvr.Cells[0]; if (rbSaveNow.Checked) { SaveRecord2Local(fr.EditedRecord); } } }