Post by pei on Apr 27, 2006 3:38:05 GMT -5
Public Class Form1
Dim intWrong As Integer = 0
Dim intCount As Integer = 0
Dim intTimer As Integer = 0
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
If intCount = 0 Then txtDisplay.Text = _
"Once upon a time there were three little pigs."
If intCount = 1 Then txtDisplay.Text = _
"In days gone by times were hard but the people were strong."
If intCount = 2 Then txtDisplay.Text = _
"Once in a while something special happens even to the " _
& "worst of people."
If intCount = 3 Then txtDisplay.Text = _
"When injustice rears its head, it is the duty of all good " _
& "citizens to object."
If intCount = 4 Then txtDisplay.Text = _
"Its Has been said that in the end there can b only one. " _
& "Let that one be Mighty Molly."
btnDone.Enabled = True
btnGo.Enabled = False
txtEntry.ReadOnly = False
tmrControl.Enabled = True
intTimer = 0
txtEntry.Focus()
End Sub
Private Sub btnDone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDone.Click
stbControl.Text = ""
tmrControl.Enabled = False
If txtEntry.Text = "" Then
MessageBox.Show("Error You must enter something!")
txtEntry.Text = ""
txtDisplay.Text = ""
btnDone.Enabled = False
btnGo.Enabled = True
txtEntry.ReadOnly = True
intTimer = 0
btnGo.Focus()
Return
End If
If txtEntry.Text = txtDisplay.Text Then
MessageBox.Show("Match - You typed in the string correctly!")
intCount = intCount + 1
intTimer = 0
Else
MessageBox.Show("Strike " & intWrong + 1 _
& " - You made at least one typo.")
intWrong = intWrong + 1
intTimer = 0
End If
txtEntry.Text = ""
txtDisplay.Text = ""
btnDone.Enabled = False
btnGo.Enabled = True
txtEntry.ReadOnly = True
intTimer = 0
btnGo.Focus()
If intWrong = 3 Then
If intCount < 2 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is: Beginner. Please try again!")
intCount = 0
intWrong = 0
Return
End If
If intCount < 4 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is: Intermediate. Please play again!")
intCount = 0
intWrong = 0
Return
End If
If intCount < 5 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is: Advanced. Please try again!")
End If
End If
If intCount = 5 Then
MessageBox.Show("Game completed. Your typing skill level " _
& "is: Expert. Please play again!")
intCount = 0
intWrong = 0
Return
End If
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Application.Exit()
End Sub
Private Sub tmrControl_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrControl.Tick
intTimer = intTimer + 1
stbControl.Text = "Seconds remaining: " & (150 - intTimer)
If intTimer = 150 Then
intWrong = intWrong + 1
tmrControl.Enabled = False
stbControl.Text = ""
MessageBox.Show("Strike " & intWrong & " - Time is up. " _
& "Please play again!")
txtEntry.Text = ""
txtDisplay.Text = ""
btnDone.Enabled = False
btnGo.Enabled = True
txtEntry.ReadOnly = True
btnGo.Focus()
If intWrong = 3 Then
If intCount < 2 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is: beginner. Please play again!")
intCount = 0
intWrong = 0
Return
End If
If intCount < 4 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is : Intermediate. Please play again!")
intCount = 0
intWrong = 0
Return
End If
If intCount < 5 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is: Advanced. Please play again!")
intCount = 0
intWrong = 0
Return
End If
End If
If intCount = 5 Then
MessageBox.Show("Game complete. Your typing skill level " _
& "is:Expert. Please play again!")
intCount = 0
intWrong = 0
Return
End If
End If
End Sub
End Class
Dim intWrong As Integer = 0
Dim intCount As Integer = 0
Dim intTimer As Integer = 0
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
If intCount = 0 Then txtDisplay.Text = _
"Once upon a time there were three little pigs."
If intCount = 1 Then txtDisplay.Text = _
"In days gone by times were hard but the people were strong."
If intCount = 2 Then txtDisplay.Text = _
"Once in a while something special happens even to the " _
& "worst of people."
If intCount = 3 Then txtDisplay.Text = _
"When injustice rears its head, it is the duty of all good " _
& "citizens to object."
If intCount = 4 Then txtDisplay.Text = _
"Its Has been said that in the end there can b only one. " _
& "Let that one be Mighty Molly."
btnDone.Enabled = True
btnGo.Enabled = False
txtEntry.ReadOnly = False
tmrControl.Enabled = True
intTimer = 0
txtEntry.Focus()
End Sub
Private Sub btnDone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDone.Click
stbControl.Text = ""
tmrControl.Enabled = False
If txtEntry.Text = "" Then
MessageBox.Show("Error You must enter something!")
txtEntry.Text = ""
txtDisplay.Text = ""
btnDone.Enabled = False
btnGo.Enabled = True
txtEntry.ReadOnly = True
intTimer = 0
btnGo.Focus()
Return
End If
If txtEntry.Text = txtDisplay.Text Then
MessageBox.Show("Match - You typed in the string correctly!")
intCount = intCount + 1
intTimer = 0
Else
MessageBox.Show("Strike " & intWrong + 1 _
& " - You made at least one typo.")
intWrong = intWrong + 1
intTimer = 0
End If
txtEntry.Text = ""
txtDisplay.Text = ""
btnDone.Enabled = False
btnGo.Enabled = True
txtEntry.ReadOnly = True
intTimer = 0
btnGo.Focus()
If intWrong = 3 Then
If intCount < 2 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is: Beginner. Please try again!")
intCount = 0
intWrong = 0
Return
End If
If intCount < 4 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is: Intermediate. Please play again!")
intCount = 0
intWrong = 0
Return
End If
If intCount < 5 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is: Advanced. Please try again!")
End If
End If
If intCount = 5 Then
MessageBox.Show("Game completed. Your typing skill level " _
& "is: Expert. Please play again!")
intCount = 0
intWrong = 0
Return
End If
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Application.Exit()
End Sub
Private Sub tmrControl_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrControl.Tick
intTimer = intTimer + 1
stbControl.Text = "Seconds remaining: " & (150 - intTimer)
If intTimer = 150 Then
intWrong = intWrong + 1
tmrControl.Enabled = False
stbControl.Text = ""
MessageBox.Show("Strike " & intWrong & " - Time is up. " _
& "Please play again!")
txtEntry.Text = ""
txtDisplay.Text = ""
btnDone.Enabled = False
btnGo.Enabled = True
txtEntry.ReadOnly = True
btnGo.Focus()
If intWrong = 3 Then
If intCount < 2 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is: beginner. Please play again!")
intCount = 0
intWrong = 0
Return
End If
If intCount < 4 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is : Intermediate. Please play again!")
intCount = 0
intWrong = 0
Return
End If
If intCount < 5 Then
MessageBox.Show("Game over. Your typing skill level " _
& "is: Advanced. Please play again!")
intCount = 0
intWrong = 0
Return
End If
End If
If intCount = 5 Then
MessageBox.Show("Game complete. Your typing skill level " _
& "is:Expert. Please play again!")
intCount = 0
intWrong = 0
Return
End If
End If
End Sub
End Class