miércoles, 12 de noviembre de 2008

Codigo para realizar una calculadora

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

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

End Sub

Private Sub Command1_Click()
num1 = Val(visor.Text)
resp = 9 / 5 * num1 + 32
visor.Text = resp

End Sub

Private Sub Command2_Click()
num1 = Val(visor.Text)
resp = 5 / 9 * (num1 - 32)
visor.Text = resp

End Sub

Private Sub Command3_Click()
num1 = Val(visor.Text)
resp = num1 + 273
visor.Text = resp

End Sub

Private Sub Command4_Click()
num1 = Val(visor.Text)
resp = num1 - 273
visor.Text = resp

End Sub

Private Sub Command5_Click()
num1 = Val(visor.Text)
resp = 5 / 9 * (num1 - 32) + 273
visor.Text = resp

End Sub

Private Sub Command6_Click()
num1 = Val(visor.Text)
resp = 9 / 5 * (num1 - 273) + 32
visor.Text = resp

End Sub

Private Sub Command7_Click()

resp = Val(visor.Text) * -1
visor.Text = resp

End Sub

Private Sub Command8_Click()
num1 = Val(visor.Text)
If num1 < num1 =" Sqr(num1)" text =" num1" num1 =" Val(visor.Text)" resp =" num1" text =" resp" num1 =" Val(visor.Text)" opera =" 4" text = " " num1 =" Val(visor.Text)" opera =" 5" text = " " num1 =" 0" num2 =" 0" resp =" 0" num2 =" Val(visor.Text)" opera =" 1" resp =" num1" opera =" 2" resp =" num1" opera =" 3" resp =" num1" opera =" 4" num2 =" 0" resp =" num1" opera =" 5" num2 =" 0" resp =" num1" opera =" 6" num2 =" 0" resp =" num1" opera =" 7" num2 =" 0" resp =" num1" text =" resp" num1 =" Val(visor.Text)" opera =" 6" text = " " num1 =" Val(visor.Text)" opera =" 3" text = " " text =" visor.Text" text =" visor.Text" text =" visor.Text" text =" visor.Text" text =" visor.Text" text =" visor.Text" text =" visor.Text" text =" visor.Text" text =" visor.Text" text =" visor.Text" num1 =" Val(visor.Text)" opera =" 7" text = " " num1 =" Val(visor.Text)" opera =" 2" text = " " num1 =" Val(visor.Text)" opera =" 1" text = " "> 57 Then
KeyAscii = 0
End If
End Sub


No hay comentarios: