Private
Sub
cmdEnde_Click()
Unload
Me
End
Sub
Private
Sub
cmdFertig_Click()
Dim
bteVorgabezahl
As
Byte
Dim
bteEingabezahl
As
Byte
Dim
strAntwort1
As
String
Dim
strAntwort2
As
String
Dim
bteMaximum
As
Byte
Dim
bteMinimum
As
Byte
bteVorgabezahl = Val(
Me
.txtEingabe.Value)
bteEingabezahl = Val(
Me
.txtRaten.Value)
bteMinimum = bteVorgabezahl - 10
bteMaximum = bteVorgabezahl + 10
If
bteVorgabezahl <= 0
Then
strAntwort1 = MsgBox(
"Sie mogeln! Die Zahl soll größer als 0 sein!"
, vbOK,
"Mogelhinweis"
)
Me
.txtEingabe.Text =
""
Me
.txtEingabe.SetFocus
ElseIf
bteVorgabezahl >= 100
Then
strAntwort1 = MsgBox(
"Sie mogeln! Die Zahl soll kleiner als 100 sein!"
, vbOK,
"Mogelhinweis"
)
Me
.txtEingabe.Text =
""
Me
.txtEingabe.SetFocus
Else
Select
Case
bteEingabezahl
Case
Is
= bteVorgabezahl
strAntwort1 =
"Gratulation. Sie haben es geschafft!"
Case
Is
>= bteMinimum
strAntwort1 =
"Das ist schon ziemlich gut."
Case
Is
<= bteMaximum
strAntwort1 =
"Das ist schon ziemlich gut."
Case
Is
> bteMaximum
strAntwort1 =
"Strengen Sie sich etwas mehr an!"
Case
Is
< bteMinimum
strAntwort1 =
"Strengen Sie sich etwas mehr an!"
Case
Is
< bteVorgabezahl
strAntwort2 =
"Sie müssen in größeren Dimensionen denken."
Case
Is
> bteVorgabezahl
strAntwort2 =
"Sie werden übermütig."
Case
Else
End
Select
End
If
txtergebis=strantwort1+vbnewline+strantwort2
End
Sub