So Ive been trying to add a count of how many times heads and tales have been flipped. I'm sure its probably simple but Ive been at this for about 10 hours. Any help would really be appreciated.
Because once the Button1_Click event has finished, every value inside of there will cease to exist.
Therefore you store your counting variables elsewhere, so you can reference them inside of Button1_Click and increase their values without losing them when it's finished.
Those aren't globals. You can even declare them Private, in which case they're class variables. However, variables within a sub will always be disposed and recreated when you exit the sub (out of scope).
You can actually declare the variables in the sub, if you say "Static countHeads" instead of Dim. Static means that they won't be reset each time the sub it called.
1
u/C4_Ghost Oct 23 '19
So Ive been trying to add a count of how many times heads and tales have been flipped. I'm sure its probably simple but Ive been at this for about 10 hours. Any help would really be appreciated.