Quote:
How to reset the variable to start from 1 every time the button pressed ?
the most strait forward way is to reset the value at beginning of button code.
lineReadCounter = 0;
Quote:
if I press button StatusBtn_Click the first time it will display lineReadCounter starting from 1.
But if I press the button for second time or more times it will return lineReadCounter starting from 2
The code is only doing what you asked for by making the variable static.
private static int lineReadCounter = 0;