I've programmed in Basic in the past but I'm brand new to VB. I'm trying to understand the timer function. I wrote a short program to display a count from 1 to 20 in one second intervals or so I thought.
Here's the code:
Dim Counter As Integer
Counter = 1
Do
Timer1.Enabled = False
TextBox1.Text = Counter
Timer1.Enabled = True
Counter = Counter + 1
Loop While Counter < 21
End
I put this under a Button_Click event with the Timer_Tick listed first. The Timer_Tick has no code associated with it and the interval is 1000. When I run the progam, it stops in less than a second and ends and the form goes back to design mode.
I've also tried For-Next and If statements to increment the counter but nothing works. What am I doing wrong?
Thanks for the help.
Here's the code:
Dim Counter As Integer
Counter = 1
Do
Timer1.Enabled = False
TextBox1.Text = Counter
Timer1.Enabled = True
Counter = Counter + 1
Loop While Counter < 21
End
I put this under a Button_Click event with the Timer_Tick listed first. The Timer_Tick has no code associated with it and the interval is 1000. When I run the progam, it stops in less than a second and ends and the form goes back to design mode.
I've also tried For-Next and If statements to increment the counter but nothing works. What am I doing wrong?
Thanks for the help.