Growing Counter in a Texbox [duplicate]

1

I'm developing software that every time the user clicks the save button, he needs to add +1 to a TextBox .

Ex: Box = 1 - > Save - > Box = 2.

Every time the user clicks save , he has to change the box number, always adding 1. I tried to count in TextBox and convert the value to% with% after add a count but did not pay.

Why a string ? Because my user will always need to enter the initial value of the last box that he closed.

Ex: The day ended in 32 Box, the next day he needs to set to box 33, from there every time he starts clicking save , he would add 1.

private void textBox44_TextChanged(object sender, EventArgs e)
{
    int valor = Convert.ToInt32(textBox44);
    valor = valor++;
}
    
asked by anonymous 16.11.2016 / 14:16

1 answer

1

You are trying to convert TextBox to integer, not text. If you want to use the text, use the Text property

int valor = Convert.ToInt32(textBox44.Text);
    
16.11.2016 / 14:18