I am teaching my vb.net slowly but surely. I'm not having much luck determing how to properly use a timer.
Basically, to learn how to use a timer I am making a very simple little program, that gives and X-location and a Y-Location for "your ship" a SPEED and HEADING as well.
When you click on a forward button I want the x and y locations to change depending on your heading, and I want it to update this every 10th of a second or so.
So I am putting the form1_load into an infinite loop.
I am using the following code snippet I found to try and set this up, but am getting an error when I compile about WithEvents. The following snippet isn't MY program, it is just the only info I have found about these timers so far. If needed, I can post the source for my app. I just know next to nothing about the whole timer/tick stuff. Does anyone know of a tutorial someplace, or can anyone give me some help with this class??
Mark
-------
Private timecounter As Int32 = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000 '1 second (timer works in millisecs.
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
timecounter += 1
Label1.Text = Str(timecounter)
End Sub
Basically, to learn how to use a timer I am making a very simple little program, that gives and X-location and a Y-Location for "your ship" a SPEED and HEADING as well.
When you click on a forward button I want the x and y locations to change depending on your heading, and I want it to update this every 10th of a second or so.
So I am putting the form1_load into an infinite loop.
I am using the following code snippet I found to try and set this up, but am getting an error when I compile about WithEvents. The following snippet isn't MY program, it is just the only info I have found about these timers so far. If needed, I can post the source for my app. I just know next to nothing about the whole timer/tick stuff. Does anyone know of a tutorial someplace, or can anyone give me some help with this class??
Mark
-------
Private timecounter As Int32 = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000 '1 second (timer works in millisecs.
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
timecounter += 1
Label1.Text = Str(timecounter)
End Sub