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