private void btnClear_Click(object sender, EventArgs e) { txtCodigo.Text = ""; txtReferencia.Text = ""; txtDescricao.Text = ""; txtValor.Text = "0,00"; txtCusto.Text = "0,00"; pPopulaProdutos(); //Consulta todos os grupos cmbGrupo.DataSource = GrupoController.ListarTodosGrupos(); }
private void pPopulaGrupos() { //Consulta todos os grupos List <grupos> objGrupos = GrupoController.ListarTodosGrupos(); DataGridViewRow dgvr; dgvGrupos.Rows.Clear(); //Percorre o objeto para preencher a grid foreach (var item in objGrupos) { dgvr = new DataGridViewRow(); dgvr.CreateCells(dgvGrupos); dgvr.Cells[ColunaId.Index].Value = item.id; dgvr.Cells[ColunaDescricao.Index].Value = item.descricao; dgvGrupos.Rows.Add(dgvr); } }