我在标签控件中有一个标签,它作为随机分配的ID号的“占位符”。当用户选择加载医疗记录表时,应该为ID标签分配一个随机数,将其文本从“此处的记录ID”改为指定的号码。
我有另一个标签,它不在标签控件中,但以相同的方式布局(两者都在各自形式的构造函数中),并且它完美地运行。为什么会出现这个问题,以及如何对其进行排序呢?
标签控件中标签的代码:
medicalRecordIDRand = new Random();
medicalRecordID = medicalRecordIDRand.Next(100000, 999999);
lblMedicalRecordID.Text = medicalRecordID.ToString();
MessageBox.Show("To add a new medical record, please choose 'Records', then 'New Record'. A unique ID number for this medical record has already been pre-assigned.", "For Your Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
lblMedicalRecordID.Text = medicalRecordID.ToString();
标签的代码正常工作:
patientIDRand = new Random();
patientIDNumber = patientIDRand.Next(1002, 9999);
MessageBox.Show("To add a new patient, please choose 'File', then 'New Patient'. A unique ID number for this patient has already been pre-assigned to this record.", "For Your Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
lblPatientIDProper.Text = patientIDNumber.ToString();
答案 0 :(得分:0)
我发现了我的错误,我正在查看另一个标签。感谢wdosanjos试图提供帮助,这是非常感谢。一切都按现在的设计进行。