组合框显示成员不显示使用列表对象 c#
Combox Display member Not Showing using list Object c#
这是对象定义:
class TestScanOrder
{
public long OrderCodeField { get; set; }
public long PatientCodeField { get; set; }
public string PatientNameField { get; set; }
public string PatientVal { get; set; }
public DateTime DateTimeField { get; set; }
public TestScanOrder(DateTime dt,long order,long pateintCode,string patientName,string patientVal)
{
DateTimeField = dt;
OrderCodeField = order;
PatientCodeField = pateintCode;
PatientNameField = patientName;
PatientVal = patientVal;
}
列表是
TestScanOrder[] list = new TestScanOrder[]{
new TestScanOrder( Convert.ToDateTime("06/24/2015"), 1910, 65547, "Raja", 65547 + "~" + 1910 + "~" + 1 ),
new TestScanOrder(Convert.ToDateTime("06/25/2015"), 1911, 65548, "Roja", 65548 + "~" + 1911 + "~" + 1 ),
new TestScanOrder( Convert.ToDateTime("06/26/2015"), 1912, 65549, "Peter", 65549 + "~" + 1912 + "~" + 2 ),
new TestScanOrder( Convert.ToDateTime("06/27/2015"), 1913, 65550, "jaya", 65550 + "~" + 1913 + "~" + 2 ),
new TestScanOrder(Convert.ToDateTime("06/28/2015"), 1914, 65551, "Vijaya", 65551 + "~" + 1914 + "~" + 1 )
};
cbPatients.DisplayMember = "PatientName";<br>
cbPatients.DataSource = 列表;<br>
cbPatients.ValueMember = 空;
然而,当我在上面开火时,我得到的就是:
如何在组合框中获取患者姓名
请帮我解决这些问题
在"TestScanOrder"class中属性的患者姓名是"PatientNameField",所以用下面的来指定组合框的显示成员-
cbPatients.DisplayMember = "PatientNameField";
当为显示成员指定无效 属性 名称时,代码不会中断,而是使用数据源中 class 的完全限定名称填充组合。
这是对象定义:
class TestScanOrder
{
public long OrderCodeField { get; set; }
public long PatientCodeField { get; set; }
public string PatientNameField { get; set; }
public string PatientVal { get; set; }
public DateTime DateTimeField { get; set; }
public TestScanOrder(DateTime dt,long order,long pateintCode,string patientName,string patientVal)
{
DateTimeField = dt;
OrderCodeField = order;
PatientCodeField = pateintCode;
PatientNameField = patientName;
PatientVal = patientVal;
}
列表是
TestScanOrder[] list = new TestScanOrder[]{
new TestScanOrder( Convert.ToDateTime("06/24/2015"), 1910, 65547, "Raja", 65547 + "~" + 1910 + "~" + 1 ),
new TestScanOrder(Convert.ToDateTime("06/25/2015"), 1911, 65548, "Roja", 65548 + "~" + 1911 + "~" + 1 ),
new TestScanOrder( Convert.ToDateTime("06/26/2015"), 1912, 65549, "Peter", 65549 + "~" + 1912 + "~" + 2 ),
new TestScanOrder( Convert.ToDateTime("06/27/2015"), 1913, 65550, "jaya", 65550 + "~" + 1913 + "~" + 2 ),
new TestScanOrder(Convert.ToDateTime("06/28/2015"), 1914, 65551, "Vijaya", 65551 + "~" + 1914 + "~" + 1 )
};
cbPatients.DisplayMember = "PatientName";<br>
cbPatients.DataSource = 列表;<br>
cbPatients.ValueMember = 空;
然而,当我在上面开火时,我得到的就是:
如何在组合框中获取患者姓名 请帮我解决这些问题
在"TestScanOrder"class中属性的患者姓名是"PatientNameField",所以用下面的来指定组合框的显示成员-
cbPatients.DisplayMember = "PatientNameField";
当为显示成员指定无效 属性 名称时,代码不会中断,而是使用数据源中 class 的完全限定名称填充组合。