viernes, 26 de septiembre de 2008
Calculadora de Visual Basic (por Nicolás y Telma)
Private Sub borrar_Click()
barra.Caption = " "
End Sub
Private Sub cero_Click()
barra.Caption = barra.Caption + "0"
End Sub
Private Sub cinco_Click()
barra.Caption = barra.Caption + "5"
End Sub
Private Sub coma_Click()
barra.Caption = barra.Caption + "."
End Sub
Private Sub cuatro_Click()
barra.Caption = barra.Caption + "4"
End Sub
Private Sub diagonal_Click()
auxnro.Caption = barra.Caption
auxopr.Caption = "/"
barra.Caption = ""
End Sub
Private Sub dos_Click()
barra.Caption = barra.Caption + "2"
End Sub
Private Sub igual_Click()
If auxopr.Caption = "+" Then
barra.Caption = Val(auxnro.Caption) + Val(barra.Caption)
auxnro.Caption = ""
auxopr.Caption = ""
End If
If auxopr.Caption = "-" Then
barra.Caption = Val(auxnro.Caption) - Val(barra.Caption)
auxnro.Caption = ""
auxopr.Caption = ""
End If
If auxopr.Caption = "*" Then
barra.Caption = Val(auxnro.Caption) * Val(barra.Caption)
auxnro.Caption = ""
auxopr.Caption = ""
End If
If auxopr.Caption = "/" Then
barra.Caption = Val(auxnro.Caption) / Val(barra.Caption)
auxnro.Caption = ""
auxopr.Caption = ""
End If
End Sub
Private Sub mas_Click()
auxnro.Caption = barra.Caption
auxopr.Caption = "+"
barra.Caption = ""
End Sub
Private Sub menos_Click()
auxnro.Caption = barra.Caption
auxopr.Caption = "-"
barra.Caption = ""
End Sub
Private Sub multiplicar_Click()
auxnro.Caption = barra.Caption
auxopr.Caption = "*"
barra.Caption = ""
End Sub
Private Sub nueve_Click()
barra.Caption = barra.Caption + "9"
End Sub
Private Sub ocho_Click()
barra.Caption = barra.Caption + "8"
End Sub
Private Sub seis_Click()
barra.Caption = barra.Caption + "6"
End Sub
Private Sub siete_Click()
barra.Caption = barra.Caption + "7"
End Sub
Private Sub tres_Click()
barra.Caption = barra.Caption + "3"
End Sub
Private Sub uno_Click()
barra.Caption = barra.Caption + "1"
End Sub
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario