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".
 
Back
Top