C#怎么在日期后面逐渐加一自动生成不同的编号?
在textbox中生成如2007-04-28-001,2007-04-28-002以此类推生成编号
------解决方案--------------------截取前面的字节长度,然后把后面的三位字符转为数字,加1之后前面补零,补足三位即可
------解决方案--------------------string tmp = "2007-04-28-002 "
if(System.DateTime.Now.ToShortDateString() == tmp.SubString(0,10))
{
int mCount = Convert.ToInt32(tmp.Sub(10));
mCount++;
string mCountTmp = "000 " + mCount.ToString();
mCountTmp = mCountTmp.SubString(mCountTmp.Length - 3);
tmp = tmp.SubString(0,10) + mCountTmp;
}
else
{
tmp = System.DateTime.Now.ToShortDateString() + "001 ";
}