Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: ::: Devil ::: en 15 Diciembre 2008, 16:45 pm



Título: problemas al dividir
Publicado por: ::: Devil ::: en 15 Diciembre 2008, 16:45 pm
ahora otro problemita que me a surgido tengo esto

Private Sub Text43_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
Text45.Text = Val(Text3.Text) + Val(Text7.Text) + Val(Text11.Text) + Val(Text15.Text) + Val(Text19.Text) + Val(Text23.Text) + Val(Text27.Text) + Val(Text31.Text) + Val(Text35.Text) + Val(Text39.Text) + Val(Text43.Text)
End If
End Sub

ahora quiero que el resultado de esa suma se divida entre el numero que yo coloco en un textbox aparte

el textbox que meto el numero para dividir es el text58


Título: Re: problemas al dividir
Publicado por: Novlucker en 15 Diciembre 2008, 16:57 pm
Código
  1. resultado = val(Text45.text)/val(Text58.text)
Cual sería la pregunta? (https://foro.elhacker.net/Smileys/chef/xd.gif)


Título: Re: problemas al dividir
Publicado por: ::: Devil ::: en 15 Diciembre 2008, 17:02 pm
el problema radica en que el resultado de toda la suma se encuentra en el textbox 45

y cuando hago esto

Text45.Text = Val(Text45.Text) / Val(Text58.Text)

me sale que el resultado es 0

y no es asi



Título: Re: problemas al dividir
Publicado por: ::: Devil ::: en 15 Diciembre 2008, 17:06 pm
ya lo resolvi

Private Sub Text43_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
Text45.Text = Val(Text3.Text) + Val(Text7.Text) + Val(Text11.Text) + Val(Text15.Text) + Val(Text19.Text) + Val(Text23.Text) + Val(Text27.Text) + Val(Text31.Text) + Val(Text35.Text) + Val(Text39.Text) + Val(Text43.Text)
Text45.Text = Val(Text45.Text) / Val(Text58)
End If
End Sub


Título: Re: problemas al dividir
Publicado por: viviz02 en 15 Diciembre 2008, 17:51 pm
Y no es eso lo que te habian dicho en el post de antes :huh: