jueves, 25 de septiembre de 2008

Codigos de calculadora de Visual Basic 1

Private Sub borrar_Click()
pantalla.Caption = ""
auxnro.Caption = ""
auxoper.Caption = ""
End Sub

Private Sub cero_Click()
pantalla.Caption = pantalla.Caption + "0"
End Sub

Private Sub cinco_Click()
pantalla.Caption = pantalla.Caption + "5"
End Sub

Private Sub coma_Click()
pantalla.Caption = pantalla.Caption + "."
End Sub

Private Sub cuatro_Click()
pantalla.Caption = pantalla.Caption + "4"
End Sub

Private Sub dos_Click()
pantalla.Caption = pantalla.Caption + "2"
End Sub

Private Sub igual_Click()
If auxoper.Caption = "+" Then
pantalla.Caption = Val(auxnro.Caption) + Val(pantalla.Caption)
auxnro.Caption = ""
auxoper.Caption = ""
End If
If auxoper.Caption = "-" Then
pantalla.Caption = Val(auxnro.Caption) - Val(pantalla.Caption)
auxnro.Caption = ""
auxoper.Caption = ""
End If
End Sub

Private Sub mas_Click()
auxnro.Caption = pantalla.Caption
auxoper.Caption = "+"
pantalla.Caption = ""
End Sub

Private Sub menos_Click()
auxnro.Caption = pantalla.Caption
auxoper.Caption = "-"
pantalla.Caption = ""
End Sub

Private Sub nueve_Click()
pantalla.Caption = pantalla.Caption + "9"
End Sub

Private Sub ocho_Click()
pantalla.Caption = pantalla.Caption + "8"
End Sub

Private Sub seis_Click()
pantalla.Caption = pantalla.Caption + "6"
End Sub

Private Sub siete_Click()
pantalla.Caption = pantalla.Caption + "7"
End Sub

Private Sub tres_Click()
pantalla.Caption = pantalla.Caption + "3"
End Sub

Private Sub uno_Click()
pantalla.Caption = pantalla.Caption + "1"
End Sub

No hay comentarios: