C#
has no global variables. Possibly do you mean a class member variable?
In the reset button you are declaring (and initializing) a new instance of the variable and thus shadowing the (possible) class member variable.
You have to change (in the reset button command handler) from:
int i = 0;
to
i = 0;