...

View Full Version : Identifier Expected? VB



AqworldThunder
11-04-2012, 08:21 PM
So when I was writing code to a program it gave me a error in the first line that said "Identifier Expected" here is the code to the program.






Public Class
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim RND As New Random
ElectricButton1.Location = New Point(RND.Next(1, 270), RND.Next(1, 270))
End Sub

Private Sub ElectricButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ElectricButton1.Click
If Timer1.Interval = 50 Then MsgBox("You have won!") : End
MsgBox("FASTER!!")
Timer1.Interval -= 50 : ToolStripStatus1.Text += 50
End Sub

Private Sub ElectricButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ElectricButton2.Click
ElectricButton1.Show()
ElectricButton2.Hide()
End Sub
End Class

aljones
11-05-2012, 04:27 PM
Your class has to have a name ...

Public Class <somename>

Would take care of that error. (obviously replace '<somename>' with the class name of your choice.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum