自动在标签框/文本框中生成发票编号 [英] invoice id Number auto generate in lable box / text box

查看:127
本文介绍了自动在标签框/文本框中生成发票编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以C#格式创建自动生成的编号/ID?
当我单击保存"/确定"按钮时,应生成发票编号/id,并在标签框/文本框中输入值.
请帮助我,我很担心.
如果您对唯一标识符感到满意,则可以使用GUID.

您可以尝试以下代码:我在表单上添加了标签"label1"和按钮确定",而click事件为:

 私有  void  ok_Click(对象发​​件人,EventArgs e)
       {
           label1.Text = Guid.NewGuid().ToString();
       }



亲切的问候


从表中获取最大发票编号并将其递增1,然后在标签或文本框中设置值

  SELECT  Max(ISNULL(InvoiceNo, 0 ))+  1   FROM  [TableName] 


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.!!

解决方案

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:

private void ok_Click(object sender, EventArgs e)
       {
           label1.Text = Guid.NewGuid().ToString();
       }



kind regards


Get the Max invoice Number from the table and increment it by 1 and then set the value in the label or textbox

SELECT Max(ISNULL(InvoiceNo, 0)) + 1 FROM [TableName]


这篇关于自动在标签框/文本框中生成发票编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆