Auto Generate alphanumeric Unique Id with C#

后端 未结 5 561
忘了有多久
忘了有多久 2021-01-18 12:49

Total string length is 5 chars

I have a scenario, ID starts with

A0001 and ends with A9999 then B0001 to B9999 until F0001 to f9999

after that

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-18 12:58

    see this code

    private void button1_Click(object sender, EventArgs e)
    {   
        string get = label1.Text.Substring(7); //label1.text=ATHCUS-100
        MessageBox.Show(get);
        string ou="ATHCUS-"+(Convert.ToInt32(get)+1).ToString();
        label1.Text = ou.ToString();
    
    }
    

提交回复
热议问题