Module Module1
Public cccounter = 9
End Module
Public Class frmNim
Private Sub btnSelect_Click(sender As System.Object, e As System.EventArgs) Handles btnSelect.Click
MsgBox(cccounter)
End Sub
End Class
Why does this generate errors? I can’t figure out any other way to make a simple counter go up by clicking on a button. This is frustrating me to no end. Is there something very simple that I’m obviously missing?
Use
MessageBox.Show(ccounter)I think you’re using the old VB6 coding. This won’t work in VB.NET.
MSDN
If you need your counter to go up, you do need an extra line of code:
EDIT:
Missed the declaration in the module (VB.Net bit rusty now a days)
You should declare the ccounter as a variable as mentioned by @Eddie Paz)
I’ve made a quick sample that adds 1 at every click on the button.