Question
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress If Timer1.Enabled = False Then Timer1.Enabled = True ' press Esc butonn to
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress If Timer1.Enabled = False Then Timer1.Enabled = True
' press Esc butonn to restart the game If e.KeyChar.ToString = "" Then ' restart the game Timer1.Enabled = False Curent_Char = 1 Label5.Text = "" Time_Label.Text = "00:00" The_Time = 0 mistakes_Count = 0 Wrong_Label.Text = 0 Exit Sub End If
' checking the chracter If e.KeyChar = Mid(The_Text, Curent_Char, 1) Then
Label5.Text = Label5.Text & Mid(The_Text, Curent_Char, 1)
' checking if the user finsh the exercies If Label5.Text = The_Text Then Timer1.Enabled = False MsgBox("excellent you have done the exercise during : " & Time_Label.Text & " and mistakes number : " & mistakes_Count, , "Good job") ' restart the game Curent_Char = 1 Label5.Text = "" Time_Label.Text = "00:00" The_Time = 0 mistakes_Count = 0 Wrong_Label.Text = 0 Exit Sub End If Curent_Char += 1
Else Beep() mistakes_Count += 1 Wrong_Label.Text = mistakes_Count Me.BackColor = (Color.Red) Timer2.Enabled = True End If End Sub
This is a time typing game for visual basic, how could I possible get this to loop so you'll have to type the work 5 times before excecuting the 'restart game' sequence
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started