private void btnAdd_Click(object sender, EventArgs e) { StudentClickUI student = new StudentClickUI(); student.popUpAdd(); student.ShowDialog(); dataGridStudent.DataSource = new BindingSource(lhr.GetStudentDatatable(), null); dataGridStudent.ClearSelection(); _selectedRollGrid = 0; _selectedNameGrid = null; _selectedStudentId = 0; }
private void btnUpdate_Click(object sender, EventArgs e) { if (_selectedRollGrid != 0) { StudentClickUI student = new StudentClickUI(); student.popUpUpdate(_selectedRollGrid, _selectedNameGrid, _selectedStudentId); student.ShowDialog(); dataGridStudent.DataSource = new BindingSource(lhr.GetStudentDatatable(), null); dataGridStudent.ClearSelection(); _selectedRollGrid = 0; _selectedNameGrid = null; _selectedStudentId = 0; } else { MessageBox.Show("Please click on index cell to update"); } }