private void LlenarGrid() { DataTable dt = new DataTable(); try { P.Idproducto = Program.Idproducto; P.Estado = true; P.Idsucursal = 0; dt = P.ListadoPrecios(); dtgPrecio.Rows.Clear(); for (int x = 0; x < dt.Rows.Count; x++) { dtgPrecio.Rows.Add(dt.Rows[x][0]); dtgPrecio.Rows[x].Cells[0].Value = dt.Rows[x][0].ToString(); dtgPrecio.Rows[x].Cells[1].Value = dt.Rows[x][1].ToString(); dtgPrecio.Rows[x].Cells[2].Value = dt.Rows[x][2].ToString(); dtgPrecio.Rows[x].Cells[3].Value = dt.Rows[x][3].ToString(); dtgPrecio.Rows[x].Cells[4].Value = dt.Rows[x][4].ToString(); } dtgPrecio.ClearSelection(); } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "FactSYS", MessageBoxButtons.OK, MessageBoxIcon.Information); } }