472,119 Members | 1,524 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Sort ComboBox

C# .NET 1.1

How do I sort ComboBox in descending order?

Thanks
Peter
Feb 7 '06 #1
4 32246
I think you should sort the items before adding/binding to the
combobox. For example, you could use Array.Sort, ArrayList.Sort, or
using DataView if you are binding DataSet to the combobox. There are
also Array.Reserve and ArrayList.Reserve method for you to change the
order if neccesary.

Thi

Feb 7 '06 #2

"Truong Hong Thi" <th*****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I think you should sort the items before adding/binding to the
combobox. For example, you could use Array.Sort, ArrayList.Sort, or
using DataView if you are binding DataSet to the combobox. There are
also Array.Reserve and ArrayList.Reserve method for you to change the
order if neccesary.

Thi


What is the best way dump the contents of the ComboBox into an ArrayList?

I have an unbound ComboBox and I want to sort this combo in either
direction.
Feb 7 '06 #3
This is the easiest way if the items implements IComparable (for
example: strings):
ArrayList list = ArrayList.Adapter(comboBox1.Items);
list.Sort();
To reverse, call list.Reverse();

Thi

Peter wrote:
"Truong Hong Thi" <th*****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I think you should sort the items before adding/binding to the
combobox. For example, you could use Array.Sort, ArrayList.Sort, or
using DataView if you are binding DataSet to the combobox. There are
also Array.Reserve and ArrayList.Reserve method for you to change the
order if neccesary.

Thi


What is the best way dump the contents of the ComboBox into an ArrayList?

I have an unbound ComboBox and I want to sort this combo in either
direction.


Feb 7 '06 #4

"Truong Hong Thi" <th*****@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
This is the easiest way if the items implements IComparable (for
example: strings):
ArrayList list = ArrayList.Adapter(comboBox1.Items);
list.Sort();
To reverse, call list.Reverse();

Thi

Peter wrote:
"Truong Hong Thi" <th*****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
>I think you should sort the items before adding/binding to the
> combobox. For example, you could use Array.Sort, ArrayList.Sort, or
> using DataView if you are binding DataSet to the combobox. There are
> also Array.Reserve and ArrayList.Reserve method for you to change the
> order if neccesary.
>
> Thi
>


What is the best way dump the contents of the ComboBox into an ArrayList?

I have an unbound ComboBox and I want to sort this combo in either
direction.


Thank You,

works for me.
Feb 7 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by MrNobody | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.