

Maybe handle the Click event of "+" button in this manner:
textBox.Text = "1";
You could use a custom TextBox
public class TextBoxUpDown : TextBox
{
public TextBoxUpDown()
{
Text = "0";
}
private int _value;
public void Increment()
{
_value += 1;
Text = _value.ToString();
}
public void Decrement()
{
_value -= 1;
Text = _value.ToString();
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public int Value => _value;
}
Usage
private void IncrementButton_Click(object sender, EventArgs e)
{
textBoxUpDown1.Increment();
}
private void DecrementButton_Click(object sender, EventArgs e)
{
textBoxUpDown1.Decrement();
}
private void ValueButton_Click(object sender, EventArgs e)
{
MessageBox.Show(textBoxUpDown1.Value.ToString());
}
Hi MajeedPurseyedmahdi-3716,
Do you want to achieve the following situation?
int Number = 0;
private void button1_Click(object sender, EventArgs e)
{
Number ++;
textBox1.Text = Number.ToString();
}

If not, please explain in detail.
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Display row number from database to text box in C #.entity framwork code first
Hi @MajeedPurseyedmahdi-3716,
Without more information and code, we can’t determine where you encountered the problem.
And there are some examples on how to use Entity Framework to obtain line numbers through LINQ in the following links, hope to help you.
Get Row Index in a list by using entity framework
Get record's row number using Linq
How to get index using LINQ? [duplicate
Best Regards,
Daniel Zhang
11 people are following this question.