private void search(object sender, EventArgs e) { CustomernameText.Enabled = true; AddressText.Enabled = true; string search = searchTextBox.Text; if (search == "" || search == "What do you want to seach?") { MessageBox.Show(null, "Enter correct Number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { customers = controller.PhoneSearch(search); if (customers.Count != 0) { foreach (var item in customers) { CustomernameText.Text = item.Name; AddressText.Text = item.Address; id = item.ID; PhoneText.Text = item.Phone; } PhoneLbl.Visible = false; PhoneText.Visible = false; UpdateBtn.Visible = true; UpdateBtn.Text = "Update"; FinishBtn.Visible = true; flag2 = true; } else { MessageBox.Show(null, "Number Not Exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); CustomernameText.Text = "Enter Customer Name"; AddressText.Text = "Enter Customer Address"; CustomernameText.Enabled = true; AddressText.Enabled = true; PhoneLbl.Visible = true; PhoneText.Visible = true; PhoneText.Text = searchTextBox.Text; FinishBtn.Visible = true; UpdateBtn.Visible = true; UpdateBtn.Text = "Add Customer"; } } }