private void buttonBuscar_Click(object sender, EventArgs e) { dataGridView1.Rows.Clear(); dataGridView1.Refresh(); int rutaId = Convert.ToInt32(comboBoxRutas.SelectedValue); RutasBLL.Buscar(x => x.RutaId == rutaId, true); foreach (var cliente in RutasBLL.rutaReturned.Clientes) { DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone(); row.Cells[0].Value = cliente.Nombres; row.Cells[1].Value = cliente.Direccion; dataGridView1.Rows.Add(row); } }
private void buttonBuscar_Click(object sender, EventArgs e) { if (UtilidadesFormularios.Validar(maskedTextBoxId)) { int id = int.Parse(maskedTextBoxId.Text); if (RutasBLL.Buscar(x => x.RutaId == id, false)) { LlenarFormulario(RutasBLL.rutaReturned); } else { toolStripLabelHaciendo.Text = "Esta ruta no existe"; } } else { toolStripLabelHaciendo.Text = "Datos incorrectos"; } }