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(Staff sm, int index) { InitializeComponent(); tabControl1.SelectedIndex = index; sm = newStaffMember; tabIndex = index; lblDateHiredStaff.Visible = true; dateTimeStaffHired.Visible = true; }
public EditMember(Staff sm, int tabIndexSwitch) { InitializeComponent(); txtFirstName.Text = sm.FirstName; txtLastName.Text = sm.LastName; dateTimeStaffHired.Value = sm.DateHired; editStaffMember = sm; STSmSwitch = tabIndexSwitch; tabControl1.SelectedIndex = STSmSwitch; lblDateHiredStaff.Visible = true; dateTimeStaffHired.Visible = true; }