private void LlenarGrid() { DataTable dt = new DataTable(); if (rbActivo.Checked) { dt = C.Listar(true); } else if (rbInactivo.Checked) { dt = C.Listar(false); } try { dtgDepartamento.Rows.Clear(); for (int x = 0; x < dt.Rows.Count; x++) { dtgDepartamento.Rows.Add(dt.Rows[x][0]); dtgDepartamento.Rows[x].Cells[0].Value = dt.Rows[x][0].ToString(); dtgDepartamento.Rows[x].Cells[1].Value = dt.Rows[x][1].ToString(); dtgDepartamento.Rows[x].Cells[2].Value = dt.Rows[x][2].ToString(); } dtgDepartamento.ClearSelection(); } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "FactSYS", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void LlenarComboDpto() { try { cbDpto.DataSource = Dp.Listar(true); cbDpto.DisplayMember = "DESCRIPCION"; cbDpto.ValueMember = "ID_departamento"; } catch (Exception ex) { MessageBoxEx.Show(ex.Message); } }