private void extraerProductos() { foreach (DataGridViewRow row in dgvProductos.Rows) { ObjectSaveProducto productoFila = new ObjectSaveProducto(); productoFila.codigoProducto = row.Cells[0].Value.ToString(); productoFila.nombreProducto = row.Cells[1].Value.ToString(); productoFila.precioCompra = row.Cells[2].Value.ToString(); productoFila.precioVenta = row.Cells[3].Value.ToString(); productoFila.marca = row.Cells[4].Value.ToString(); productoFila.unidad = row.Cells[5].Value.ToString(); productoFila.stock = row.Cells[6].Value.ToString(); listaProductos.Add(productoFila); //MessageBox.Show(row.Cells[0].Value.ToString() + " " + row.Cells[1].Value.ToString() + " " + // row.Cells[2].Value.ToString() + " " + row.Cells[3].Value.ToString()+" "+ row.Cells[5].Value.ToString()+ " "+row.Cells[6].Value.ToString()); } }
private void extraerProductos() { appLoadState(true); btnGuardar.Enabled = false; foreach (DataGridViewRow row in dgvProductos.Rows) { ObjectSaveProducto productoFila = new ObjectSaveProducto(); productoFila.codigoProducto = row.Cells[0].Value.ToString(); productoFila.nombreProducto = row.Cells[1].Value.ToString(); productoFila.precioCompra = row.Cells[2].Value.ToString(); productoFila.precioVenta = row.Cells[3].Value.ToString(); productoFila.marca = row.Cells[4].Value.ToString(); productoFila.unidad = row.Cells[5].Value.ToString(); productoFila.stock = row.Cells[6].Value.ToString(); productoFila.categoria = row.Cells[7].Value.ToString(); listaProductos.Add(productoFila); //MessageBox.Show(row.Cells[0].Value.ToString() + " " + row.Cells[1].Value.ToString() + " " + // row.Cells[2].Value.ToString() + " " + row.Cells[3].Value.ToString()+" "+ row.Cells[5].Value.ToString()+ " "+row.Cells[6].Value.ToString()); } btnGuardar.Enabled = true; appLoadState(false); }