//Search private void buttonClSearch_Click(object sender, EventArgs e) { Client aclient = new Client(); if (!string.IsNullOrEmpty(textBoxClSearch.Text)) { switch (comboBoxClSearch.SelectedIndex) { case -1: MessageBox.Show("Please select a valid search option!"); return; case 0: int tempId; if (!int.TryParse(textBoxClSearch.Text, out tempId)) { MessageBox.Show("Please enter a valid term to be searched.", "No search information!"); return; } aclient = ClientDA.SearchID(Convert.ToInt32(textBoxClSearch.Text)); break; case 1: aclient = ClientDA.SearchName(textBoxClSearch.Text); break; } if (aclient == null) { MessageBox.Show("Client not found!", "Not found!"); textBoxClSearch.Clear(); textBoxClSearch.Focus(); return; } ClientDA.ListSearch(aclient, listViewSales); return; } MessageBox.Show("Please enter a valid term to be searched.", "No search information!"); return; }