Clapy2202
April 20th, 2003, 07:48 AM
I have tried to increase an int variable when I press a button. The problem is that it works only the first time. After that, when I press the button it does the same thing over and over again.
For example:
public class WebForm1 : System.Web.UI.Page
...........
public int n;
............
private void Button1_Click(object sender, System.EventArgs e)
{
nr++
LabelTest.Text = nr.ToString();
}
I have tried the exactly same thing on a windows form and it' working just fine. Can anyone tell me how I can remember an incremented value?
I think it could be done if I would use a DataBase (SQL or something), but I would like to avoid using one.
For example:
public class WebForm1 : System.Web.UI.Page
...........
public int n;
............
private void Button1_Click(object sender, System.EventArgs e)
{
nr++
LabelTest.Text = nr.ToString();
}
I have tried the exactly same thing on a windows form and it' working just fine. Can anyone tell me how I can remember an incremented value?
I think it could be done if I would use a DataBase (SQL or something), but I would like to avoid using one.