[英]Auto Increment c# in Excel
I have here a line of code increment number but every I register a patient the sampleNum
didn't increment.我在这里有一行代码增量编号,但每次我注册一个患者, sampleNum
没有增加。 Please help me with this.请帮我解决一下这个。
Please click the image.请点击图片。 I already have a line of code for increment a patient number.我已经有一行代码用于增加患者编号。 But every time I register a patient the sampleNum
did not increment.但是每次我注册一个病人时, sampleNum
没有增加。 My point here is every time I register a patient the PatientNumber will increment by 1. Then as you can see in my excel 2 RP00 means my code didn't increment.我的观点是,每次我注册患者时,PatientNumber 都会增加 1。然后你可以在我的 excel 2 RP00 中看到,这意味着我的代码没有增加。
Here is a simple program that will ask you for the number of patients to register and print out their formatted patient numbers.这是一个简单的程序,它会询问您登记的患者人数并打印出他们格式化的患者编号。 I trust that studying it will prove helpful to you completing your homework mission我相信学习它会帮助你完成你的家庭作业
public class Program
{
public static void Main()
{
Console.WriteLine("How many?");
int howMany = int.Parse(Console.ReadLine());
int patNum = 0;
while(howMany > 0){
patNum++;
RegisterPatient(x);
howMany--;
}
}
public static void RegisterPatient(int patientNumber){
string pn = patientNumber.ToString("RP0000");
Console.WriteLine("Now registering patient "+pn);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.