2008/09/25

CALCULADORA POR VISUAL BASIC POR MARCOS

Private Sub BARRA_Click()
AUXILIAR.Caption = visor.Caption
AUXILIARDOS.Caption = "/"
visor.Caption = ""
End Sub

Private Sub borrar_Click()
visor.Caption = ""
End Sub

Private Sub CERO_Click()
visor.Caption = visor.Caption + "0"
End Sub

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

Private Sub COMA_Click()
visor.Caption = visor.Caption + "."
End Sub

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

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

Private Sub IGUAL_Click()
If AUXILIARDOS.Caption = "+" Then
visor.Caption = Val(AUXILIAR.Caption) + Val(visor.Caption)
AUXILIAR.Caption = ""
AUXILIARDOS.Caption = ""
End If
If AUXILIARDOS.Caption = "-" Then
visor.Caption = Val(AUXILIAR.Caption) - Val(visor.Caption)
AUXILIAR.Caption = ""
AUXILIARDOS.Caption = ""
End If
If AUXILIARDOS.Caption = "*" Then
visor.Caption = Val(AUXILIAR.Caption) * Val(visor.Caption)
AUXILIAR.Caption = ""
AUXILIARDOS.Caption = ""
End If
If AUXILIARDOS.Caption = "/" Then
visor.Caption = Val(AUXILIAR.Caption) / Val(visor.Caption)
AUXILIAR.Caption = ""
AUXILIARDOS.Caption = ""
End If
End Sub

Private Sub MAS_Click()
AUXILIAR.Caption = visor.Caption
AUXILIARDOS.Caption = "+"
visor.Caption = ""
End Sub

Private Sub MENOS_Click()
AUXILIAR.Caption = visor.Caption
AUXILIARDOS.Caption = "-"
visor.Caption = ""
End Sub

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

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

Private Sub POR_Click()
AUXILIAR.Caption = visor.Caption
AUXILIARDOS.Caption = "*"
visor.Caption = ""
End Sub

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

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

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

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

No hay comentarios: