This post originated from an RSS feed registered with .NET Buzz
by Richard Jonas.
Original Post: Sorting a Data-Bound ComboBox
Feed Title: Richard Jonas
Feed URL: http://feeds.feedburner.com/blogspot/ouNA
Feed Description: Richard Jonas's blog about .NET, web development and agile methodologies.
I have set up a view with an order by clause and bound it to a ComboBox using ADO.NET 2.0. The combo box did not take any notice of the order by clause, and seemed to display items in the order they appeared in the database tables that made up the view.
To fix this, I had to manually set the Sort property of the column I wanted the combo box to be ordered by on the BindingSource used by the control as follows before calling the Fill method on the table adapter :-