Sorting in Combo Box

  • Thread starter Thread starter Lalit Bhatia
  • Start date Start date
L

Lalit Bhatia

After setting Sorted porperty of combo box to true, data in the combo does
not appear.
I have combo bound to Datatable.
What is the reason for that?
 
Are you seeing an ArgumentException? The help indicates that this exception
should be thrown when "an attempt was made to sort a ComboBox that is
attached to a data source."
http://msdn.microsoft.com/library/d...ystemwindowsformscomboboxclasssortedtopic.asp

Try creating a DataView, using the DataTable, and set the sort order using
the DataView objects Sort property. Then assign the DataView object to the
DataSource property of the ComboBox.
http://msdn.microsoft.com/library/d...tml/frlrfsystemdatadataviewclasssorttopic.asp

Make sure that the Sorted property of the ComboBox is set back to "false".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top