Free Source Code and Tutorials

Custom Search

C#: Autonumber in a TextBox

autonumberCSHARPoutput autonumberIn this tutorial, I’m going to show you how to create an autonumber in the TextBox in This process has the ability to auto generate the number in the TextBox when the button is clicked. It is very useful for the future use, most specially when developing a system.


Let’s get started:


1. Open Microsoft Visual Studio 2008 and create new Windows Form Application for C#. Then, drag a TextBox and Button in the do the Form.


2. After setting up the Form, double click the “click” button to fire the click event handler. Then, put the following code into it.

 private void button1_Click(object sender, EventArgs e)
//declare a variable for storing the incremented value into it
 int autonum=1; 
//set the formula for the incrementing of a textbox
 autonum = autonum + int.Parse(textBox1.Text);
//put the value in the textbox.
 textBox1.Text = autonum.ToString();

Description: The number in the TextBox will be incremented by 1 when the button is clicked.




For all students who need programmer for your thesis system or anyone who needs a sourcecode in any programming languages. You can contact me @ :

Email –
Mobile No. – 09305235027 – tnt

Facebook Comments
(Visited 11 times, 1 visits today)
Share this

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked * © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!

%d bloggers like this: