
07/01/2009, 21:22
|
| | Fecha de Ingreso: enero-2009
Mensajes: 20
Antigüedad: 16 años, 1 mes Puntos: 0 | |
Respuesta: Realizar Operacion dentro de un DataGridView Bueno yo estoy haciendo este trabajo en C# pero estaba intentando una forma y creo q se puede hacer mediante una variable y asignarle a cada textboxcolum. Aqui les mando un codigo a ver si me pueden ayudar ...gracias privatevoid Generar() { DataTable dt = newDataTable(); string CODCLIENTE, NOMCLIENTE, CANTIDAD, PRECIO, SUBTOTAL; CODCLIENTE = (dataGridView1.Rows[i].Cells[0].Value).ToString(); NOMCLIENTE = dataGridView1.Rows[i].Cells[1].ToString(); PRECIO = dataGridView1.Rows[i].Cells[2].ToString(); CANTIDAD = (dataGridView1.Rows[i].Cells[3].Value).ToString(); SUBTOTAL = dataGridView1.Rows[i].Cells[4].ToString(); DataRow dr = dt.Rows.Find(CODCLIENTE); if (int.Parse(CANTIDAD) > 0) { if (dr != null) //Ya esta en el carrito { //dr["DESCRIPCION"] = DESCRIPCION; dr["Precio"] = PRECIO; dr["Cantidad"] = CANTIDAD; double dSUBTOTAL = double.Parse(PRECIO) * double.Parse(CANTIDAD); dr["SubTotal"] = dSUBTOTAL.ToString("##0.00;(##0.00);0"); } } } |