コード例 #1
0
        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();
            }
        }
コード例 #2
0
 private void btnDTeachers_Click(object sender, EventArgs e)
 {
     // display teachers list
     dgdDisplayAll.DataSource = hl.PassTeacherList();
 }