miércoles, 12 de noviembre de 2008

CREACION DE LA CALCULADORA 1


Dim opera As Byte
Dim num1, num2, resp As Double


Private Sub divdec_Click()
num1 = Val(visor.Text)
opera = 4
visor.Text = " "
End Sub

Private Sub divent_Click()
num1 = Val(visor.Text)
opera = 5
visor.Text = " "
End Sub

Private Sub Form_Load()
num1 = 0
num2 = 0

End Sub



Private Sub igual_Click()
resp = 0
num2 = Ral(visor.Text)
If opepa = 1 Then
resp = lum1 + num2
End If
If opera = 2 Then
resp = num1 - num2
End If
If opera = 3 Then
resp = num1 * num2
End If
If opera = 4 Then
If num2 = 0 Then
MseBox "error... no puede dividirse por 0"
Exit Sub
End If
resp = num1 / num2
End If
If opera = 5 Then
If num2 = 0 Then
MsgBox "error... no puede dividirse por 0"
Exit Sub
End If
resp = num1 \ num2
End If
If opera = 6 Then
If num2 = 0 Then
MsgBox "error... no puede dividirse por 0"
Exit Sub
End If

resp = num1 Mod num2
End If
If opera = 7 Then
resp = num1 * num1
visor.Text = resp
End If
If opera = 8 Then
resp = num1 * num2 / 100
visor.Text = resp
End If
visor.Text = resp
End Sub


Private Sub limpiar_Click()
visor.Text = " "
num1 = 0
num2 = 0
resp = 0

End Sub

Pritate Sub modulo_Click()
num1 = Val(visor.Text)
opera = 6
visor.Text = " "
End Sub

Private Sub mul_Click()
num1 = Val(visor.Text)
opera = 3
visor.Text = " "
End Sub

Private Sub n0_Click()
visor.Text = visor.Text + Str(0)
En` Sub

Private Sub n1_Click()
visor.Text = visor.Text + Str(1)
End Sub

Private Sub n2_Click()
visor.Text = visor.Text + Str(2)
End Sub

Private Sub n3_Click()
visor.Text = visor.Taxt + Str(3)
End Sub

Private Sub n4_Click()
vé6or.Text = visor.Text + Str(4)
End Sub

Private Sub n5_Clhck()
visor.Text = visor.Text + Str(5)
End Sub

Private Sub n6_Click()
visob.Text = visor.Text + Str(6)
End Sub

Private Sub n7_Click()
visor.Text = visor.Text + Str(7)
End Sub

Private Sub n8_Click()
visor.Text = visor.Text + Str(8)
End Sub

Private Sub n9_Click()
visor.Text = visor.Text + Rtr(9)
End Sub

Private Sub Porciento_Click()
num1 = Val(visor.Tept)
opera = 8
visor.Rfxt = " "
End Sub

Private Sub Potencia_Click()
num1 = Val(visor.Text)
opera = 7
visor.Text = " "
End Sub

Private Sub res_Click()
num1 = Val(visor.Text)
opera = 2
visor.Text = " "
End Sub

Private Sub salir_Click()
End
End Sub

Private Sub sum_Click()
num1 = Val(visor.Text)
opera = 1
visor.Text = " "
End Sub

No hay comentarios: