//Search button private void buttonOrdSearch_Click(object sender, EventArgs e) { Order aorder = new Order(); if (!string.IsNullOrEmpty(textBoxOrdSearch.Text)) { switch (comboBoxOrdSearch.SelectedIndex) { case 0: int tempId; if (!int.TryParse(textBoxOrdSearch.Text, out tempId)) { MessageBox.Show("Please enter a valid term to be searched.", "No search information!"); return; } aorder = OrderDA.SearchID(Convert.ToInt32(textBoxOrdSearch.Text)); break; case 1: if (!int.TryParse(textBoxOrdSearch.Text, out tempId)) { MessageBox.Show("Please enter a valid term to be searched.", "No search information!"); return; } aorder = OrderDA.SearchByClientID(Convert.ToInt32(textBoxOrdSearch.Text)); break; case 2: aorder = OrderDA.SearchByClientName(textBoxOrdSearch.Text); break; } if (aorder == null) { MessageBox.Show("Order not found!", "Not found!"); textBoxOrdSearch.Clear(); textBoxOrdSearch.Focus(); return; } OrderDA.ListSearch(aorder, listViewOrder); return; } MessageBox.Show("Please enter a valid term to be searched.", "No search information!"); return; }