That depends on the environment you are in.
The procedure for WinForms is very different from the procedure for a web site.
For WinForms, all you need to do is move teh definition to class level, so it is not within the click event handler:
private int myInt = 6;
private void myButton_Click(object sender, EventArgs e)
{
myInt++;
}
For Web, it is a bit more complex, because class variables are not maintained after a page is loaded to the client (and they will all be reset before a post back). In this case, use the Session:
int myInt = Session["MyInt"];
...
myInt++;
...
Session["MyInt"] = myInt;