void kbtnNew_Click(object sender, EventArgs e) { var holder = new HolderInfo { DateOfBirth = DrivingLicense.MinDate }; var dl = new DrivingLicense { Id = 0, Holder = holder, DateOfIssue = DateTime.Now, DateOfExpiry = DateTime.Now.AddYears(ValidityPeriod), Status = TextUI.InWait }; var frm = new DrivingLicenseObjectForm { Object = dl, ShowInTaskbar = false }; var dr = frm.ShowDialog(); if (dr == DialogResult.OK) { FillDataGrid(); } }
void kdgvData_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } var cr = kdgvData.CurrentRow; if (ReferenceEquals(cr, null)) { return; } var objView = (ObjectView <DrivingLicense>)cr.DataBoundItem; var dl = objView.Object; var frm = new DrivingLicenseObjectForm { Object = dl, ShowInTaskbar = false }; var dr = frm.ShowDialog(); if (dr == DialogResult.OK) { FillDataGrid(); } }