viernes, 26 de septiembre de 2008

Visual Basic (por Ari y Iaru)



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 cuatro_Click()
barra.Caption = barra.Caption + "4"
End Sub

Private Sub dividido_Click()
auxiliar2.Caption = dividido.Caption
auxiliar.Caption = barra.Caption
barra.Caption = ""
End Sub

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

Private Sub igual_Click()
If auxiliar2.Caption = "+" Then
barra.Caption = Val(auxiliar.Caption) + Val(barra.Caption)
auxiliar.Caption = ""
End If
If auxiliar2.Caption = "-" Then
barra.Caption = Val(auxiliar.Caption) - Val(barra.Caption)
auxiliar.Caption = ""
End If
If auxiliar2.Caption = "*" Then
barra.Caption = Val(auxiliar.Caption) * Val(barra.Caption)
auxiliar.Caption = ""
End If
If auxiliar2.Caption = "/" Then
barra.Caption = Val(auxiliar.Caption) / Val(barra.Caption)
auxiliar.Caption = ""
End If
auxiliar2.Caption = ""
End Sub

Private Sub mas_Click()
auxiliar.Caption = barra.Caption
barra.Caption = ""
auxiliar2.Caption = mas.Caption
End Sub

Private Sub menos_Click()
auxiliar.Caption = barra.Caption
barra.Caption = ""
auxiliar2.Caption = menos.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 por_Click()
auxiliar2.Caption = por.Caption
auxiliar.Caption = barra.Caption
barra.Caption = ""

End Sub

Private Sub porcentaje_Click()
auxiliar2.Caption = barra.Caption
auxiliar2.Caption = Val(auxiliar2 * 100)


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

No hay comentarios: