sasikumar

sasikumar

  • NA
  • 15
  • 0

How to Sort a bindinglist ?

Jan 18 2012 5:49 AM
Hi,

Please help in sorting the below list --

var varSource = new BindingList<KeyValuePair<string, string>>();

varSource.Add(new KeyValuePair<string, string>("key1", "value1"));
varSource.Add(new KeyValuePair<string, string>("key4", "value4"));
varSource.Add(new KeyValuePair<string, string>("key3", "value3"));
varSource.Add(new KeyValuePair<string, string>("key5", "value5"));
varSource.Add(new KeyValuePair<string, string>("key2", "value2"));

How do I sort the above list before binding it to a combo box so that the details are listed in ascending order in the combobox?
Please advise.

Thanks.


Answers (4)