Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in my application employee id load into combo box but that unsorted order.how to view combo box data in sorted order
Posted
Comments
Muhammad Saqlain 12-Nov-14 11:57am    
Can you elaborate your question? Question is incomplete
Dusara Maulik 12-Nov-14 23:34pm    
Sergey Alexandrovich Kryukov 22-Nov-14 20:57pm    
When you say "ComboBox", what do you mean, exactly? Which one? Full type name, please.
—SA

Hi,
You can provide order by in select query
 
Share this answer
 
You can specify that items be added to a list in alphabetical order by setting the Sorted property to True and omitting the index. The sort is not case-sensitive; thus, the words "chardonnay" and "Chardonnay" are treated the same.
When the Sorted property is set to True, using the AddItem method with the index argument can lead to unpredictable, unsorted results.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 22-Nov-14 20:57pm    
Good point, but this is applicable only to one of the types named "ComboBox"; please see my comment to your "Solution 1". Still, I up-voted this one.
—SA
Go to property panel and change sort false to true.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 22-Nov-14 20:55pm    
Sorry, you should have fixed this answer, instead of posting Solution 3. There is a property System.Windows.Forms.ComboBox.Sorted, not "sort" and there is no such property in System.Windows.Controls.ComboBox.
You did not ask OP what is the exact type of "ComboBox" is implied, and, without it, the whole question makes little sense.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900