private void txtBuscar_KeyUp(object sender, KeyEventArgs e) { try { Control_Animal_Negocio controlNegocio = new Control_Animal_Negocio(); if (this.cbBuscar.SelectedIndex == -1) { this.txtBuscar.Enabled = false; //MessageBox.Show("Debe seleccionar un parámetro a buscar en el combo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (this.cbBuscar.SelectedItem.ToString() == "Nombre animal") { this.dgvControles.DataSource = controlNegocio.FiltrarPorNombre(this.txtBuscar.Text, idtambo); } else if (this.cbBuscar.SelectedItem.ToString() == "Caravana") { this.dgvControles.DataSource = controlNegocio.FiltrarPorCaravana(this.txtBuscar.Text, idtambo); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK); } }
private void tstxtBuscar_KeyUp(object sender, KeyEventArgs e) { try { Control_Animal_Negocio controlNegocio = new Control_Animal_Negocio(); this.dgvControles.DataSource = controlNegocio.FiltrarPorNombre(this.tstxtBuscar.Text, idtambo); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK); } }