CanTheyMeet.CanTheyMeet.searchPerson1_Click C# (CSharp) Method

searchPerson1_Click() private method

private searchPerson1_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void searchPerson1_Click(object sender, EventArgs e)
        {
            p1.Name = comboboxPerson1.Text;
            var fine = new List<Person>();
            string compare = comboboxPerson1.Text.ToUpper();
            foreach (Person p in people)
            {
                if (p.Name.Contains(compare))
                {
                    fine.Add(p);
                }
            }
            comboboxPerson1.DataSource = fine;
            comboboxPerson1.DisplayMember = Name;
            comboboxPerson1.SelectedIndex = 0;
        }

Same methods

CanTheyMeet::searchPerson1_Click ( object sender, KeyPressEventArgs e ) : void