Good afternoon ..
I have a txtbox1.Tex in my form, and I need to generate a 2-digit sequential number automatically. EX 01, 02, 03 and so on, and it shows in txtbox.
Someone could help me.
Thank you.
Good afternoon ..
I have a txtbox1.Tex in my form, and I need to generate a 2-digit sequential number automatically. EX 01, 02, 03 and so on, and it shows in txtbox.
Someone could help me.
Thank you.
In the form:
private int _contador = 0;
In the method in which you will change the text:
this._contador++;
this.txtBox1.Text = this._contador.ToString().PadLeft(2, '0');
The PadLeft
method class String
receives two parameters. The first one says the minimum length you want to have, and the second one says which character you are going to fill in on the left.
Good morning, I tried to do it here in my system and I could not, it does not appear the numbering in my textbox, I put it in the method:
private void txtnumvenpdv_TextChanged(object sender, EventArgs e)
{
this._contador++;
this.txtnumvenpdv.Text = this._contador.ToString().PadLeft(2, '0');
}