private void btnAdd_Click(object sender, EventArgs e) { switch (tabControl1.SelectedIndex) { case 0: //student Student ns = new Student(); NewMember addNewStudent = new NewMember(ns, tabControl1.SelectedIndex); addNewStudent.ShowDialog(); populateStudents(); break; case 1: //teacher Teacher nt = new Teacher(); NewMember addNewTeacher = new NewMember(nt, tabControl1.SelectedIndex); addNewTeacher.ShowDialog(); populateTeachers(); break; case 2: //staff Staff nsm = new Staff(); NewMember addNewStaff = new NewMember(nsm, tabControl1.SelectedIndex); addNewStaff.ShowDialog(); populateStaff(); break; } }
public NewMember(Teacher t, int index) { InitializeComponent(); tabControl1.SelectedIndex = index; t = newTeacher; tabIndex = index; lblDepartment.Visible = true; lblDateHiredTeacher.Visible = true; dateTimeTeacherHired.Visible = true; cbTeacherDepartment.Visible = true; }
public EditMember(Teacher t, int tabIndexSwitch) { InitializeComponent(); txtFirstName.Text = t.FirstName; txtLastName.Text = t.LastName; dateTimeTeacherHired.Value = t.DateHired; cbTeacherDepartment.Text = t.Department; editTeacher = t; STSmSwitch = tabIndexSwitch; tabControl1.SelectedIndex = STSmSwitch; lblDateHiredTeacher.Visible = true; dateTimeTeacherHired.Visible = true; lblDepartment.Visible = true; cbTeacherDepartment.Visible = true; }