Hai,
I have one doubt.I am doing billing software. In this project the bill number want to generate automatically from database and also it should be unique like bill_01,bill_02....., and I want to display it to one textbox. After that I want to saved all details to database.
Please help me for how to generate bill number automatically from form loading.....
Thanks in advance
Loading

Anupam SinghRank #643 · 3.7K reputationPosted Apr 16, 2014, 2:01 AM EDT
find the method to generate number in sequence. I am using the silar pattern in one of my project.
public string GenerateNumber(string ReceivedId)
{
// OR0000 // pattern
if (string.IsNullOrEmpty(ReceivedId))
{
ReceivedId = "BILL_000001";
}
string nextId = string.Empty;
int len = ReceivedId.Length;
string splitNo = ReceivedId.Substring(5, len - 5);//This line will ignore the string values and read only the numeric values
int num = Convert.ToInt32(splitNo);
num++;// Increment the numeric value
nextId = ReceivedId.Substring(0, 5) + num.ToString("000000");//Concatenate the string value and the numeric value after the increment
return nextId;
// return null;
}
in input parameter use MAX(YOUR_DB_FIELD) .
leathu raj72 reputationPosted Apr 16, 2014, 2:25 AM EDT
Anupam SinghRank #643 · 3.7K reputationPosted Apr 16, 2014, 2:32 AM EDT
or you can mark this method as static
so you can use TextBox1.Text=GenerateNumber(your_Max_bill_no);
leathu raj72 reputationPosted Apr 16, 2014, 3:22 AM EDT