all groups > dotnet windows forms > may 2007 >
You're in the

dotnet windows forms

group:

Sorted combobox displays wrong data


Sorted combobox displays wrong data Paolo Niccolò Giubelli [Axettone]
5/7/2007 12:39:01 PM
dotnet windows forms:
Hi!
I have a tedious problem with comboboxes, as they don't display data
correctly.
Suppose I have a combobox "cmbEmployees" that shows Employee objects; class
Employee has an "Id" member and a "CompleteName" member. I set up my combobox
so to have "Id" as valuemember and "CompleteName" as displaymember. This
works good when I bind my data (cmbEmployees.DataSource=dao.GetEmployees()
and then getting an Id to display and setting cmbEmployees.SelectedValue to
it). The weird things come when I set the "Sorted" property to true... The
combobox doesn't display the employee with the requested Id... What's wrong?
Thank you in advance!!
Paolo
----------------------------------------
RE: Sorted combobox displays wrong data Manish Bafna
5/8/2007 9:34:01 PM
Hi,
Below link solves your problem:
http://usingtangent.blogspot.com/2006/08/winforms-combo-box-and-sorted-property.html
--
If my answer helped you,then please do press Yes below.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



[quoted text, click to view]
RE: Sorted combobox displays wrong data Paolo Niccolò Giubelli [Axettone]
5/8/2007 11:06:00 PM
It doesn't solve the problem, but shows how the Sorted property works (and we
can say it works BAD). The only solution is to create something like
"GetSortedEmployees()" method in my dao objects.
Thank you, the link was helpful!

[quoted text, click to view]
AddThis Social Bookmark Button