public UpdateStudentForm(int id) { InitializeComponent(); this.id = id; Business = new StudentManagement(); this.btnSave.DialogResult = System.Windows.Forms.DialogResult.Yes; this.Load += UpdateStudentForm_Load; this.btnSave.Click += btnSave_Click; this.btnCancel.Click += (sender, e) => this.Dispose(); }
public IndexStudentForm() { InitializeComponent(); this.grdStudent.Dock = DockStyle.Fill; Business = new StudentManagement(); this.Load += IndexStudentForm_Load; this.btnCreate.Click += btnCreate_Click; this.grdStudent.CellDoubleClick += grdStudent_CellDoubleClick; this.btnDelete.Click += (sender, e) => { if (MessageBox.Show("Do you want to delete selected item ?", "confirm", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { int id = int.Parse(this.grdStudent.SelectedRows[0].Cells[0].Value.ToString()); Business.DeleteStudent(id); MessageBox.Show("Deleted successfully"); LoadAllStudents(); } }; }