Click here to Skip to main content
15,562,816 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
How to create auto generate number/ID in C# form?
when i click on save / ok button, the invoice number / id should get generated and the value in lable box / text box.
plz help me i am worried.!!
Posted
Updated 4-Jul-12 22:23pm
v2
Comments
[no name] 4-Jul-12 7:57am    
"plz" is not a word. "help me i am worried.!!" but not worried enough to ask a question? How do you expect anyone to know what you mean by an invoice number or ID? That is specific to your application.

Hi uerur

if you are happy with a unique identifier then you can use a guid.

you could try this code: I've added a label "label1" and a button "Ok" on my form and the click event is:
C#
private void ok_Click(object sender, EventArgs e)
       {
           label1.Text = Guid.NewGuid().ToString();
       }


kind regards
 
Share this answer
 
Get the Max invoice Number from the table and increment it by 1 and then set the value in the label or textbox

SQL
SELECT Max(ISNULL(InvoiceNo, 0)) + 1 FROM [TableName]
 
Share this answer
 

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



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