private void btnSTeachers_Click(object sender, EventArgs e) { // clear previous search item st.Clear(); // search teachers // declaring variables bool foundMatch = false; string search = txtSearch.Text.ToUpper(); // check search input sCheck = CheckSearchItem(search); SearchPrint(sCheck); if (sCheck == 0) { // loop through teacher list for match foreach (Teacher t in hl.PassTeacherList()) { if (t.Name == search) { foundMatch = true; st.Add(t); } } // if no match found if (!foundMatch) { MessageBox.Show("No Matches Found."); } dgdDisplaySearch.DataSource = st; txtSearch.Clear(); } }
private void btnDTeachers_Click(object sender, EventArgs e) { // display teachers list dgdDisplayAll.DataSource = hl.PassTeacherList(); }