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(Student s, int index) { InitializeComponent(); tabControl1.SelectedIndex = index; s = newStudent; tabIndex = index; lblClassesPassed.Visible = true; lblGPA.Visible = true; lblMajor.Visible = true; cbMajor.Visible = true; txtClassesPassed.Visible = true; txtGPA.Visible = true; }
public EditMember(Student s, int tabIndexSwitch) { InitializeComponent(); txtFirstName.Text = s.FirstName; txtLastName.Text = s.LastName; txtGPA.Text = Convert.ToString(s.GradePointAverage); cbMajor.SelectedItem = s.Major; editStudent = s; STSmSwitch = tabIndexSwitch; tabControl1.SelectedIndex = STSmSwitch; lblGPA.Visible = true; txtGPA.Visible = true; lblMajor.Visible = true; cbMajor.Visible = true; lblClassesPassed.Visible = true; txtClassesPassed.Visible = true; }