VERSION 5.00 Begin VB.Form Form1 Caption = "Zahlenraten" ClientHeight = 3840 ClientLeft = 60 ClientTop = 345 ClientWidth = 7770 LinkTopic = "Form1" ScaleHeight = 3840 ScaleWidth = 7770 StartUpPosition = 3 'Windows Default Begin VB.TextBox tfErgebnis Height = 375 Left = 840 TabIndex = 3 Top = 2520 Width = 5775 End Begin VB.TextBox tfZahl Height = 375 Left = 2400 TabIndex = 0 Top = 1080 Width = 2535 End Begin VB.CommandButton bsTesten Caption = "Testen" Height = 375 Left = 2400 TabIndex = 1 Top = 1800 Width = 2535 End Begin VB.Label Label1 Caption = "Bitte geben Sie eine Zahlen zwischen 1 und 100 ein!" Height = 375 Left = 1800 TabIndex = 2 Top = 720 Width = 4095 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim mZufallszahl As Integer Dim mZahl As Integer Dim mErgebnis As String Private Sub Form_Load() 'Zufallszahlengenerator anschalten Randomize 'Zufallzahl zwischen 1 und 100 bestimmen mZufallszahl = CInt(Rnd * 100) + 1 Form1.Show End Sub Private Sub bsTesten_Click() przDatenuebernahme przTesten przDatenuebergabe End Sub Private Sub przDatenuebernahme() mZahl = CInt(tfZahl.Text) End Sub Private Sub przTesten() If (mZufallszahl < mZahl) _ Then mErgebnis = "Meine Zahl ist kleiner." Else If (mZufallszahl > mZahl) _ Then mErgebnis = "Meine Zahl ist größer." Else mErgebnis = "RICHTIG!!" End If End If End Sub Private Sub przDatenuebergabe() tfErgebnis.Text = mErgebnis End Sub