private void btnAddNew_Click(object sender, EventArgs e) { StudentRegistrationForm frmStudentRegistration = new StudentRegistrationForm(); frmStudentRegistration.ShowDialog(this); if (frmStudentRegistration.IsNewStudentCreate == true) { DataRow drStudentRow = dtStudentData.NewRow(); drStudentRow["StudentId"] = -99; drStudentRow["Name"] = frmStudentRegistration.StudentName; drStudentRow["DOB"] = frmStudentRegistration.DateOfBirth; drStudentRow["GradePointAvg"] = frmStudentRegistration.GradePointAvg; drStudentRow["Active"] = frmStudentRegistration.Active; dtStudentData.Rows.Add(drStudentRow); // dtStudentData.AcceptChanges(); BindDataToGrid(dtStudentData); btnSave.Enabled = true; } }
private void btnAddNew_Click(object sender, EventArgs e) { StudentRegistrationForm frmStudentRegistration = new StudentRegistrationForm(); frmStudentRegistration.ShowDialog(this); if (frmStudentRegistration.IsNewStudentCreate == true) { DataRow drStudentRow = dtStudentData.NewRow(); drStudentRow["StudentId"] = -99; drStudentRow["Name"] = frmStudentRegistration.StudentName; drStudentRow["DOB"] = frmStudentRegistration.DateOfBirth; drStudentRow["GradePointAvg"] = frmStudentRegistration.GradePointAvg; drStudentRow["Active"] = frmStudentRegistration.Active; dtStudentData.Rows.Add(drStudentRow); // dtStudentData.AcceptChanges(); BindDataToGrid(dtStudentData); btnSave.Enabled = true; } }