('inserts long story of how he is a noob')
When i was in school my teacher told me that using global variables was something to avoid at all cost. I'm trying to call the variable from another sub, and when I add the ByRef it throws an error. Probably the worst explanation every so here is the code
Here is the error I am getting.
Error 1 Method 'Public Sub dragonTimer_Tick(sender As Object, e As System.EventArgs, ByRef dragonTimeLeft As Integer)' cannot handle event 'Public Event Tick(sender As Object, e As System.EventArgs)' because they do not have a compatible signature.
When i was in school my teacher told me that using global variables was something to avoid at all cost. I'm trying to call the variable from another sub, and when I add the ByRef it throws an error. Probably the worst explanation every so here is the code
Code:
Public Sub dragonTimer_Tick(sender As Object, e As EventArgs, ByRef dragonTimeLeft As Integer) Handles dragonTimer.Tick
If dragonTimeLeft >= 0 Then
dragonTimeLeft -= 1
dragonTimeLabel.Text = dragonTimeLeft
Else
dragonTimer.Stop()
dragonTimeLabel.Text = "Respawning"
'Add a sound/voice to tell user time is up
End If
End Sub
Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim dragonTimeLeft As Integer = 360
dragonTimeLabel.Text = 360
dragonTimer.Start()
End SubError 1 Method 'Public Sub dragonTimer_Tick(sender As Object, e As System.EventArgs, ByRef dragonTimeLeft As Integer)' cannot handle event 'Public Event Tick(sender As Object, e As System.EventArgs)' because they do not have a compatible signature.