private void Form_salida_Load(object sender, EventArgs e) { dtFecha.Format = DateTimePickerFormat.Custom; dtFecha.CustomFormat = "yyyy-MM-dd"; if (folio == "0") { txtCantidad.Text = ""; txtCodigo.Text = ""; txtDescripcion.Text = ""; txtTotal.Text = ""; txtFolio.Text = ""; txtCosto.Text = ""; id = "0"; } else { Inv_out inv_out = new Inv_out(); using (inv_out) { List <Inv_out> data = inv_out.getListabyId(folio); foreach (Inv_out item in data) { txtFolio.Text = folio; txtTotal.Text = item.Total.ToString(); dtFecha.Text = item.Date.ToString(); } } Product producto = new Product(); Det_salidas detalles = new Det_salidas(); using (detalles) { List <Det_salidas> det = detalles.getDet_salidas(Convert.ToInt16(folio)); foreach (Det_salidas item in det) { using (producto) { List <Product> det_producto = producto.getProductById(item.Id_producto); foreach (Product res in det_producto) { dtProductos.Rows.Add(item.Id_producto, res.Code1, item.Cantidad, res.Description, item.P_u, item.Total.ToString()); } } } } txtCantidad.Enabled = false; txtCodigo.Enabled = false; txtDescripcion.Enabled = false; button1.Enabled = false; button2.Enabled = false; dtFecha.Enabled = false; dtProductos.Columns["cantidad"].ReadOnly = true; } }