示例#1
0
        private void btnSStudents_Click(object sender, EventArgs e)
        {
            // clear previous search item
            ss.Clear();

            // declaring variables
            bool   foundMatch = false;
            string search     = txtSearch.Text.ToUpper();

            // check search input
            sCheck = CheckSearchItem(search);
            SearchPrint(sCheck);

            if (sCheck == 0)
            {
                // loop through Student list for match
                foreach (Student s in hl.PassStudentList())
                {
                    if (s.Name == search)
                    {
                        foundMatch = true;
                        ss.Add(s);
                    }
                }

                // if no match found
                if (!foundMatch)
                {
                    MessageBox.Show("No Matches Found.");
                }

                dgdDisplaySearch.DataSource = ss;
                txtSearch.Clear();
            }
        }
 private void btnDStudents_Click(object sender, EventArgs e)
 {
     // display students list
     dgdDisplayAll.DataSource = hl.PassStudentList();
 }