Just finished the meta tag generator yesterday and it works great. Now onto a reaction time game that changes the background and sees how fast you react.
The first question is, how do I make public variables? I tried "public _startTime as DateTime" but that didn't work and either did taking the Private subs and making them Public.
It needs to be globally accessible variables so I can track the start and stop button with the time variables being in both.
The second question is.. is there a way to kill all processes without killing the program?
For example, the user clicks the Start button.. a random number is chosen and a sleep() executed. If the user presses Stop BEFORE the background changes, a messagebox would complain and then kill the process of the background changing. Simply put, if they do something too soon, I'd like to prompt them and put the program back in it's original state.. OR just stop all current processes without closing the window.
Any ideas?
Thanks!
The first question is, how do I make public variables? I tried "public _startTime as DateTime" but that didn't work and either did taking the Private subs and making them Public.
It needs to be globally accessible variables so I can track the start and stop button with the time variables being in both.
Code:
Public Sub StartBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartBtn.Click
Dim _randomNum As Integer = New System.Random(). _
Next("1", "15")
System.Threading.Thread.Sleep(1000 * _randomNum)
Dim _startTime As DateTime
Dim _stopTime As DateTime
_startTime = Now 'initiate the time NOW
'MsgBox(getRandomNumber)
Me.Label1.BackColor = System.Drawing.Color.Blue
End Sub
Public Sub StopBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StopBtn.Click
_stopTime = Now ' intiate the endtime NOW
End Sub
The second question is.. is there a way to kill all processes without killing the program?
For example, the user clicks the Start button.. a random number is chosen and a sleep() executed. If the user presses Stop BEFORE the background changes, a messagebox would complain and then kill the process of the background changing. Simply put, if they do something too soon, I'd like to prompt them and put the program back in it's original state.. OR just stop all current processes without closing the window.
Any ideas?
Thanks!