-
Same Code Diff Error
My goal was to make something that would constantly update the amount of gold that someone had. If they had X number of gold, it would display a certain image for a picturebox. You get the deal.
Here's my code. Please tell me what's wrong. I get "Error 1 'Money_Checker_Loop.My.Resources' is a namespace and cannot be used as an expression. C:\*\*\AppData\Local\Temporary Projects\Money Checker Loop\Form1.vb 33 47 Money Checker Loop
"
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static intCounter As Integer
' Increment the counter
intCounter = intCounter + 1
PlayerGold.Text = Val(intCounter)
Select Case intCounter
Case 1
PictureBox1.BackgroundImage = my.Resources.995
Case 2
PictureBox1.BackgroundImage = My.Resources.996
Case 3
PictureBox1.BackgroundImage = My.Resources.997
Case 4
PictureBox1.BackgroundImage = My.Resources.998
Case 5
PictureBox1.BackgroundImage = My.Resources.999
' This will essentially set the counter back to 1
' because the value will be incremented on the next click
intCounter = 0
End Select
End Sub
Any help would be appreciated. :)
-
Re: Same Code Diff Error
Your resource names should begin with a letter or an underscore, not a digit. Same rules apply to all identifiers in vb.net. Rename 995 to gold995 or something else starting with a letter.