| Format Currency |
| |
| |
| Const DMDollar = 0.5814 | |
| Const DollarDM = 1.72 | Hier werden die Umrechnungskurse festgelegt. |
| Const DMEuro = 0.5113 | |
| Const EuroDM = 1.9558 | |
| |
| Private Sub txtEingabe_Change() | Diese Prozedur wird aufgerufen, wenn sich der Inhalt |
| Dim Ergebnis As Currency, DollarBetrag As Currency | des Textfeldes ändert. |
| If txtEingabe.Text = "" Or IsNumeric(txtEingabe.Text) = _ | Wenn nichts eingegeben wurde oder der Inhalt nicht |
| False Then | numerisch ist, erfolgt eine Fehlermeldung. |
| lblErgebnis.Caption = "Error" | |
| Exit Sub | |
| End If | |
| DollarBetrag = CCur(txtEingabe.Text) | |
| |
| If DollarBetrag > 1000000000 Then | Ist der eingegebene Betrag zu groß? |
| MsgBox "Dieser Betrag ist zu groß!", Buttons:=vbExclamation, Title:="" |
| txtEingabe.SetFocus | |
| Exit Sub | |
| End If | |
| If Option1 Then | |
| Ergebnis = DollarBetrag * DMDollar | Rechnet DM in Dollar um. |
| lblErgebnis.Caption = Format(Ergebnis, "") & " $" | |
| End If | |
| If Option2 Then | |
| Ergebnis = DollarBetrag * DollarDM | Rechnet Dollar in DM um. |
| lblErgebnis.Caption = Format(Ergebnis, "Currency") | |
| End If | |
| If Option3 Then | |
| Ergebnis = DollarBetrag * DMEuro | Rechnet DM in Euro um. |
| lblErgebnis.Caption = Format(Ergebnis, "") & " €" | |
| End If | |
| If Option4 Then | |
| Ergebnis = DollarBetrag * EuroDM | Rechnet Euro in DM um. |
| lblErgebnis.Caption = Format(Ergebnis, "Currency") | |
| End If | |
| End Sub |
|
|
|
|
|
|
| Private Sub txtEingabe_Click() | |
| txtEingabe.Text = "" | Bei Klick aufs Textfeld wird dieses gelöscht. |
| End Sub | |
| |