Reputation: 21
I Have a bit of a problem..For some reason visual studio says there's an error--it reads:
Statement is not valid in a namespace
I can't figure out how to fix it. This is what my coded looks like and there's a blue squiggly line on the first two lines that start with Private Sub:
Private Sub btnPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlay.Click
'This procedure Starts the timer (progress bar) when the user clicks Play
'and it starts the game
Timer1.Start()
btnPlay.Enabled = True
picMainPage.Visible = False
End Sub
I hope someone can help, I'm new at this and I've been stuck with this error for three days now... :( I've tried various things from, adding END CLASS to the end of the code to re-witting the coded but I keep getting the same error message.
Upvotes: 2
Views: 15162
Reputation: 1809
Try this:
Public Class TestClass
Private Sub btnPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlay.Click
'This procedure Starts the timer (progress bar) when the user clicks Play
'and it starts the game
Timer1.Start()
btnPlay.Enabled = True
picMainPage.Visible = False
End Sub
End Class
Upvotes: 2
Reputation: 498914
You need to put methods within a class (or module or structure), not directly in a namespace.
See Structure of a Visual Basic program on MSDN.
Upvotes: 6