Quellcode:
Public Class Form1
Dim Status As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Status = 0 Then
'Frage stellen
FrageStellen(1)
TextBox1.Enabled = True
Button1.Text = "weiter"
ElseIf Status = 1 Then
AntwortTesten(1)
ElseIf Status = 2 Then
FrageStellen(2)
ElseIf Status = 3 Then
AntwortTesten(2)
ElseIf Status = 4 Then
TextBox1.Enabled = False
TextBox1.Text = ""
Label1.Text = "Fertig. Nochmal spielen?"
Button1.Text = "Ja"
Status = 0
End If
End Sub
Private Sub FrageStellen(ByVal FrageNr As Integer)
If FrageNr = 1 Then
Label1.Text = "Wie heißt die Deutsche Bundeskanzlerin?"
Status = Status + 1
ElseIf FrageNr = 2 Then
Label1.Text = "Was ist in 3 Tagen?"
Status = Status + 1
End If
TextBox1.Text = ""
TextBox1.Focus()
End Sub
Private Sub AntwortTesten(ByVal FrageNr As Integer)
If TextBox1.Text = "" Then
MsgBox("Bitte gieb deine Antwort ein.", MsgBoxStyle.OkOnly, "Frage")
ElseIf FrageNr = 1 Then
If TextBox1.Text = "Angela Merkel" Then
Label1.Text = "Richtig"
Status = Status + 1
Else
Label1.Text = "Falsch"
End If
ElseIf FrageNr = 2 Then
If TextBox1.Text = "Weihnachten" Then
Label1.Text = "Richtig"
Status = Status + 1
Else
Label1.Text = "Falsch"
End If
End If
End Sub
End Class
Dim Status As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Status = 0 Then
'Frage stellen
FrageStellen(1)
TextBox1.Enabled = True
Button1.Text = "weiter"
ElseIf Status = 1 Then
AntwortTesten(1)
ElseIf Status = 2 Then
FrageStellen(2)
ElseIf Status = 3 Then
AntwortTesten(2)
ElseIf Status = 4 Then
TextBox1.Enabled = False
TextBox1.Text = ""
Label1.Text = "Fertig. Nochmal spielen?"
Button1.Text = "Ja"
Status = 0
End If
End Sub
Private Sub FrageStellen(ByVal FrageNr As Integer)
If FrageNr = 1 Then
Label1.Text = "Wie heißt die Deutsche Bundeskanzlerin?"
Status = Status + 1
ElseIf FrageNr = 2 Then
Label1.Text = "Was ist in 3 Tagen?"
Status = Status + 1
End If
TextBox1.Text = ""
TextBox1.Focus()
End Sub
Private Sub AntwortTesten(ByVal FrageNr As Integer)
If TextBox1.Text = "" Then
MsgBox("Bitte gieb deine Antwort ein.", MsgBoxStyle.OkOnly, "Frage")
ElseIf FrageNr = 1 Then
If TextBox1.Text = "Angela Merkel" Then
Label1.Text = "Richtig"
Status = Status + 1
Else
Label1.Text = "Falsch"
End If
ElseIf FrageNr = 2 Then
If TextBox1.Text = "Weihnachten" Then
Label1.Text = "Richtig"
Status = Status + 1
Else
Label1.Text = "Falsch"
End If
End If
End Sub
End Class
Keine Kommentare:
Kommentar veröffentlichen