Quote:
Originally Posted by spud379
no its not working i tried count=count+1 and declairing as static. i must be doing something simple wrong i no that it is going into the if statement because it comes up with the messagebox after statement. and buttons disabled but not looping 10 times.
You do realise, I hope, that a variable declared within a procedure (a Sub or Function) only exists within that procedure? It may be static (remains between calls to the procedure, so doesn't get wiped each time) but it still cannot be accessed from outside of that procedure.
If you have declared a static variable within a procedure and then used the same name outside of the procedure, VB is probably just automatically creating a new variable for you, with the specified name.
You should always keep the "require explicit variable declaration" option turned on, to prevent this sort of problem.
On a simpler note, did you realise that in the code Lavs originally posted, a was set to zero just before displaying it?