EDN Admin
Well-known member
Hi there.
My application uses a web service to populate comboboxes. The webservices are fine and come back with the data.
Im having trouble setting the display member of the field, its display the namespace and object name instead of what I define in the comboBox.DisplayMember field.
Here is some sample code:
(People is an object with 2 properties, "KeyField" and "Name")
<div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px <table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap <tbody><tr><td><font style="font-size:11px People [] myPeople = MyWebService.getPeople(); </font><font style="color:green // Webservice retreive code.</font><font style="font-size:11px </font></td></tr><tr><td style="background-color:rgb(247, 247, 247) <font style="color:blue foreach</font><font style="font-size:11px (People person </font><font style="color:blue in</font><font style="font-size:11px myPeople) </font></td></tr><tr><td>{ </td></tr><tr><td style="background-color:rgb(247, 247, 247) comboBox.Items.Add(person); </td></tr><tr><td>} </td></tr><tr><td style="background-color:rgb(247, 247, 247) comboBox.DisplayMember = <font style="color:blue "Name"</font><font style="font-size:11px ; </font></td></tr></tbody></table>
When running the application, the comboBox is filled with these vales:
MyWebService.People
MyWebService.People
MyWebService.People
etc...
When is should be:
Bob
Fred
John
etc...
Has anyone got any ideas whats going on?
Many Thanks
View the full article
My application uses a web service to populate comboboxes. The webservices are fine and come back with the data.
Im having trouble setting the display member of the field, its display the namespace and object name instead of what I define in the comboBox.DisplayMember field.
Here is some sample code:
(People is an object with 2 properties, "KeyField" and "Name")
<div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px <table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap <tbody><tr><td><font style="font-size:11px People [] myPeople = MyWebService.getPeople(); </font><font style="color:green // Webservice retreive code.</font><font style="font-size:11px </font></td></tr><tr><td style="background-color:rgb(247, 247, 247) <font style="color:blue foreach</font><font style="font-size:11px (People person </font><font style="color:blue in</font><font style="font-size:11px myPeople) </font></td></tr><tr><td>{ </td></tr><tr><td style="background-color:rgb(247, 247, 247) comboBox.Items.Add(person); </td></tr><tr><td>} </td></tr><tr><td style="background-color:rgb(247, 247, 247) comboBox.DisplayMember = <font style="color:blue "Name"</font><font style="font-size:11px ; </font></td></tr></tbody></table>
When running the application, the comboBox is filled with these vales:
MyWebService.People
MyWebService.People
MyWebService.People
etc...
When is should be:
Bob
Fred
John
etc...
Has anyone got any ideas whats going on?
Many Thanks
View the full article