Rising Counter in a Texbox

Asked

Viewed 294 times

1

I am developing a software that every time the user clicks on the button salvage, it needs to add the +1 value in a TextBox.

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

Every time the user clicks salvage, he himself has to change the box number, always adding 1. I tried to make a Count in the TextBox and convert the value into string then add a Count, but it was no good.

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

Ex: The day ended in the 32 Box, the next day it needs to set to the program the 33 box, from there every time it started to click on salvage, was going to add 1.

private void textBox44_TextChanged(object sender, EventArgs e)
{
    int valor = Convert.ToInt32(textBox44);
    valor = valor++;
}

1 answer

1

Are you trying to convert one TextBox for the whole and not its text. If you want to use the text, use the property Text

int valor = Convert.ToInt32(textBox44.Text);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.