/// <summary> /// Opens SearchForm and show the founded results /// </summary> private void btnSearch_Click(object sender, EventArgs e) { SearchForm searchForm = new SearchForm(myCultureInfo); ListOfCustomer searchedCustomers = new ListOfCustomer(); if (searchForm.ShowDialog() == DialogResult.OK) { foreach (Customer oneCustomer in this.listOfCustomer) { if (oneCustomer.NAME.ToUpper().Contains(searchForm.Searchtext.ToUpper()) || oneCustomer.SURNAME.ToUpper().Contains(searchForm.Searchtext.ToUpper()) || oneCustomer.MAIL.ToUpper().Contains(searchForm.Searchtext.ToUpper()) ) { searchedCustomers.Add(oneCustomer); } } if (searchedCustomers.Count != 0) { UpdateDatagridview(searchedCustomers); } else { MessageBox.Show(Properties.Resources.stringSearch, Properties.Resources.stringError, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }