Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/01/2008, 20:06
Avatar de ElPadrino
ElPadrino
 
Fecha de Ingreso: noviembre-2007
Mensajes: 3
Antigüedad: 17 años, 6 meses
Puntos: 0
Me suma MAL los decimales!

Buenas noches amigos de Foros Del Web, tengo un problema con la suma de textbox con decimales, ya he revisado el foro pero las otras soluciones aportadas no me han sido de ayuda, espero puedan ayudarme aqui.

el caso es que estoy haciendo un pequeño sistema de facturacion y al momento de sumar los textbox (esta sumando mal) por EJEMPLO:

en la venta de 3 articulos 1,5 + 1,6 + 1,7 = 4,7 es el resultado
PERO VISUAL BASIC ME MUESTRA EN PANTALLA QUE ES RESULTADO ES "3"
por lo que obviamente no me esta sumando los decimales.

los codigos que he usado son estos:

Cita:
'subtotal
Text145.Text = Val(Text18.Text) + Val(Text27.Text) + Val(Text36.Text) + Val(Text45.Text) + Val(Text54.Text) + Val(Text63.Text) + Val(Text72.Text) + Val(Text81.Text) + Val(Text90.Text) + Val(Text99.Text) + Val(Text108.Text) + Val(Text117.Text) + Val(Text126.Text) + Val(Text135.Text) + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + a12 + a13 + a14
'IVA
Text146.Text = Val(Text17.Text) + Val(Text26.Text) + Val(Text35.Text) + Val(Text44.Text) + Val(Text53.Text) + Val(Text62.Text) + Val(Text71.Text) + Val(Text80.Text) + Val(Text89.Text) + Val(Text98.Text) + Val(Text107.Text) + Val(Text116.Text) + Val(Text125.Text) + Val(Text134.Text)
'TOTAL
Text147.Text = Val(Text145.Text) + Val(Text146.Text)
Cita:
Dim caja145 As Double
Dim caja146 As Double
Dim caja147 As Double

caja145 = CDbl (Val(Text18.Text) + Val(Text27.Text) + Val(Text36.Text) + Val(Text45.Text) + Val(Text54.Text) + Val(Text63.Text) + Val(Text72.Text) + Val(Text81.Text) + Val(Text90.Text) + Val(Text99.Text) + Val(Text108.Text) + Val(Text117.Text) + Val(Text126.Text) + Val(Text135.Text) + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + a12 + a13 + a14 )
'IVA
caja146 = CDbl (Val(Text17.Text) + Val(Text26.Text) + Val(Text35.Text) + Val(Text44.Text) + Val(Text53.Text) + Val(Text62.Text) + Val(Text71.Text) + Val(Text80.Text) + Val(Text89.Text) + Val(Text98.Text) + Val(Text107.Text) + Val(Text116.Text) + Val(Text125.Text) + Val(Text134.Text))
'TOTAL
caja147 = CDbl (Val(Text145.Text) + CDbl (Val(Text146.Text))

Text145.Text = caja145

Text146.Text = caja146

Text147.Text = caja147
Ninguno me a solucionado el problema, espero puedan ayudarme.

Última edición por ElPadrino; 02/01/2008 a las 20:10 Razón: error de escitura