Question CommandButton Counter

vbdev

New member
Joined
Dec 4, 2013
Messages
1
Programming Experience
1-3
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.
 
Back
Top