private void ListarElementos() { if (IdC.Text.Trim() != "") { cbxCategoria.DisplayMember = "Descripcion"; cbxCategoria.ValueMember = "IdCategoria"; cbxCategoria.DataSource = C.Listar(); cbxCategoria.SelectedValue = IdC.Text; } else { cbxCategoria.DisplayMember = "Descripcion"; cbxCategoria.ValueMember = "IdCategoria"; cbxCategoria.DataSource = C.Listar(); } }
private void LlenarComboCategoria() { try { cbCategoria.DataSource = C.Listar(true); cbCategoria.DisplayMember = "DESCRIPCION"; cbCategoria.ValueMember = "ID_CATEGORIA"; } catch (Exception ex) { MessageBoxEx.Show(ex.Message); } }
private void ListarElementos() { dataGridView1.ClearSelection(); DataTable dt = new DataTable(); dt = C.Listar(); try { dataGridView1.Rows.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { dataGridView1.Rows.Add(dt.Rows[i][0]); dataGridView1.Rows[i].Cells[0].Value = dt.Rows[i][0].ToString(); dataGridView1.Rows[i].Cells[1].Value = dt.Rows[i][1].ToString(); } } catch (Exception ex) { throw ex; } }
private void LlenarGridCategoria() { DataTable dt = new DataTable(); dt = C.Listar(true); try { dtgCategoria.Rows.Clear(); for (int x = 0; x < dt.Rows.Count; x++) { dtgCategoria.Rows.Add(dt.Rows[x][0]); dtgCategoria.Rows[x].Cells[0].Value = dt.Rows[x][0].ToString(); dtgCategoria.Rows[x].Cells[1].Value = dt.Rows[x][1].ToString(); dtgCategoria.Rows[x].Cells[2].Value = dt.Rows[x][2].ToString(); } dtgCategoria.ClearSelection(); } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "FactSYS", MessageBoxButtons.OK, MessageBoxIcon.Information); } }