My goal is to make a command button that, when clicked, increases a variable value by 1. I have been attempting this with a for loop, but when the button is clicked, the variable value goes straight to the terminating value. Any ideas?
What use would a loop be? A loop is for when you want to do something multiple times but you only want to increment the variable once on each Click don't you? Handle the Click event and increment the variable; that's it, that's all.
How are you declaring the variable? In order to increment its value with a button click, the variable needs to be declared at form level. You may also need a separate button to reset the variable's value to 0 or whatever the starting value should be.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.