Here is the obj def:
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;
}
And list is
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";
cbPatients.DataSource = list;
cbPatients.ValueMember = null;
However when I fire above this is all I am getting:
How Can get the PatientName in combobox Please help me out these problem
In the "TestScanOrder" class the property for patient name is "PatientNameField", so use the following to specify the display member of the combo box -
When invalid property name is specified for display member, the code will not break, and instead populate the combo with the fully qualified name of the class in data source.