Friday, September 10, 2010

Friday, September 10 2010

Forgot to set the Timer to enabled = true


If TextBox1.Text = "secret" Then
Timer1.Enabled = False
MsgBox("Welcome to the system!")
End
Else
MsgBox("That password is incorrect")
End If


The weird thing is that the program turns off afterwards.

i tried to change the timer from ending the program to selecting the text box and centering the form on the screen but I could only get it to select the textbox.



MsgBox("Sorry, your time is up.")

Me.StartPosition = FormStartPosition.CenterScreen
TextBox1.Select()


THe next Michael Halvorson tutorial is about creating modules and procedures. It uses the lucky number 7 tutorial, which I figured out from messing with it doesn't actual generate random numbers per se. the trick is to use the system clock for the generation of the numbers, it seems.

The code from the original lucky number 7 was


label1.text CStr(Int(Rnd() * 10))


I added a Randomize() before the old code and that did seem to randomize it a bit, which was good.

For a quick break, I did a status bar which I am going to incorporate into one of my game projects



If ProgressBar1.Value < 100 Then
ProgressBar1.Value += 2
ElseIf ProgressBar1.Value >= 100 And ProgressBar1.Value < 200 Then
ProgressBar1.Value += 5
Else
Timer1.Enabled = False
End If

No comments: