Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/08/2011, 16:58
tox_xo
 
Fecha de Ingreso: julio-2011
Mensajes: 13
Antigüedad: 12 años, 9 meses
Puntos: 0
Pregunta sumar datos que se encuentran en un mshflexgrid en formato moneda

Hola, el problema que tengo es que paso mis valores en formato moneda a un MSHGrid y después los quiero sumar todos para que me aparesca el valor en un textbox pero me los toma como nulos, supongo que es por el formato peso ya que antes no tenia el formato y me funcionaba perfectamente que puedo hacer para corregirlo? muchas gracias por su ayuda

Este es mi código que uso para agregar los valores a la grilla y para que se vayan sumando

Private Sub Command1_Click()
Text10 = Val(Text13) - Val(Text14)
Text12.Text = Val(Text5) * (Text3)
If grid1.TextMatrix(grid1.Rows - 1, 1) <> "" Then grid1.Rows = grid1.Rows + 1
grid1.TextMatrix(grid1.Rows - 1, 0) = Text2.Text
grid1.TextMatrix(grid1.Rows - 1, 1) = Text4.Text
grid1.TextMatrix(grid1.Rows - 1, 2) = Text8.Text
grid1.TextMatrix(grid1.Rows - 1, 3) = Text13.Text
grid1.TextMatrix(grid1.Rows - 1, 4) = Text3.Text
grid1.TextMatrix(grid1.Rows - 1, 5) = Text10.Text
'la de abajo es donde esta mi total que es el valor que quiero sumar
grid1.TextMatrix(grid1.Rows - 1, 6) = Text14.Text
grid1.Row = grid1.Rows - 1

ganancias = 0
For i = 1 To grid1.Rows - 1
ganancias = Val(grid1.TextMatrix(i, 6)) + ganancias
Next i
Text11 = ganancias


Text15 = Format(Text11, "$ ##,###,##0.00")
'text15 es el text en el que quiero que aparezca mi total el cual primero lo guardo en otro textbox (en ambos me da 0 :()


Text2 = ""
Text4 = ""
Text8 = ""
Text5 = ""
Text3 = ""
Text12 = ""
Label14 = ""
Text9 = ""
Text10 = ""


End Sub