Thread: Schoolwork help
View Single Post
Old Dec 4th, 2005, 5:39 PM   #11
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
You're declaring your variable inside the function. Every time you call the function, the variable intNumber is created, incremented and destroyed. You can work around this in one of two ways: you can use a global variable, which is created when the application starts and destroyed on exit, and declared outside of any function (usually at the top of Form or Module code), or you can declare the variable as static, which will tell it to retain its value even after the function finishes:
Static intNumber As Integer
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote