Dear Programmer i have a code for Generate Sequence Number and it is working very claver, but i am facing a error related to this code.
This Code is generate like this -
1, 2, 3, 4, 5, 6, 7, 8 .............. and so on
But is want this code like as for four digit specific -
0001, 0002, 0003, 0004, 0005 ......and so on.
Please help me out. and my code is -
private int GenerateSequenceNumber()
{
string file2 = (Server.MapPath("test.txt"));
FileInfo fiRead = new FileInfo(file2);
string input = string.Empty;
int num = 1;
if (fiRead.Exists)
{
input = File.ReadAllText(file2);
}
if (input != string.Empty)
{
num = Convert.ToInt32(input);
}
File.WriteAllText(file2, (num + 1).ToString().PadLeft(4));
return num;
}