public void ShowAddForm(MainForm mainfrm) { PopupForm add = new PopupForm(mainfrm); add.label.Text = "THÊM HỌC SINH"; add.groupBoxAdd.Visible = true; add.groupBoxAdd.BringToFront(); add.groupBoxEdit.Visible = false; add.groupBoxSearch.Visible = false; SelectedBtIndex = 1; add.Show(); }
public void ShowSearchForm(MainForm mainfrm) { //Take a instance of MainForm as argument, don't make a new instance form, so when call this func in MainForm, we call ShowSearchForm(this) PopupForm search = new PopupForm(mainfrm); search.label.Text = "TÌM KIẾM HỌC SINH"; search.groupBoxAdd.Visible = false; search.groupBoxEdit.Visible = false; search.groupBoxSearch.Visible = true; search.groupBoxSearch.BringToFront(); SelectedBtIndex = 4; search.Show(); }
public void ShowEditForm(MainForm mainfrm) { if (SelectedStudentId != "0") { PopupForm edit = new PopupForm(mainfrm); edit.label.Text = "SỬA HỌC SINH"; edit.groupBoxAdd.Visible = false; edit.groupBoxEdit.Visible = true; edit.groupBoxEdit.BringToFront(); edit.groupBoxSearch.Visible = false; SelectedBtIndex = 2; edit.Show(); } else { MessageBox.Show("Chọn sinh viên cần sửa!", "Thông báo"); } }