private void metroButton5_Click(object sender, EventArgs e) { if (txtBuscarSala.Text == "") { } else { int n = 0; mgSala.Rows.Clear(); SalaComponent SalaComponent = new SalaComponent(); foreach (var item in SalaComponent.buscar(txtBuscarSala.Text)) { n = mgSala.Rows.Add(); mgSala.Rows[n].Cells[0].Value = item.Id; mgSala.Rows[n].Cells[1].Value = item.nombre; mgSala.Rows[n].Cells[2].Value = item.tipoSala; mgSala.Rows[n].Cells[3].Value = item.capacidad; mgSala.Rows[n].Cells[4].Value = item.tiempo; } } }