Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
I want to start auto incrment number form stat - STD000001


Please any one help me its urgent .Suppose emp id is there so in that textbox id is autogenerate start with emp ex: emp10,emp11,emp12.....Please give me the answer
Posted
Comments
CHill60 10-Jul-13 12:39pm    
Are you using a database at all - you can get the database to autogenerate a number (in SQL it's done by using colname int IDENTITY(1,1)). The formatting of that number would then be as per solution 1 below

1 solution

If I understood correctly, you want the number part of the String to be always the same length.

Try this:
C#
int myInt = 23;
string myString = "STD" + myInt.ToString("0000");
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 10-Jul-13 12:27pm    
Correct, a 5.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900