[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# Sorting a listbox with more then one sort-level

Posted on 2003-12-01
Medium Priority
207 Views
Hi all

"extreme bubble-sort":

Example:

I have a listbox with let's say four columns. I want sort this list box. Ok, sounds ease, just click on the right header and that's it...

next step:

I wanna sort it with two or more sort-levels. Example

first priority: column 3
second priority: column 1
third priority: column 2

result:

a   b   a  d
a   c   a  e
b   a   a  d
b   b   a  d
a   b   b  f

Any Idea where to find such an example?

Cheers

Choli

-
0
Question by:Choli
• 4
• 3

LVL 4

Expert Comment

ID: 9851046
Add an extra collumn that contains all the keys concatenated together.  Sort on that.
0

Author Comment

ID: 9851158
ok, my question (specially my example) was not exact enough... I want to be able to sort every level either ascending or descending, so the situation could be:

column 3 ascending
column 1 descending
column 2 descending

another idea?
0

LVL 4

Expert Comment

ID: 9851221
I don't think you're going to find much joy there.  Listboxes just aren't that sophisticated.  You're probably going to wind up doing something in code that allows the user to specify the column sequence and asc/desc, then sorting an array that way and then loading the list box from the sorted array.  It's a cheesy solution, but it will work.
0

LVL 4

Accepted Solution

Clothahump earned 750 total points
ID: 9851222
I don't think you're going to find much joy there.  Listboxes just aren't that sophisticated.  You're probably going to wind up doing something in code that allows the user to specify the column sequence and asc/desc, then sorting an array that way and then loading the list box from the sorted array.  It's a cheesy solution, but it will work.
0

Author Comment

ID: 9852079
;-)

Thanx Clothahump.....

I got another solution. I just don't use a listbox. Instead I use VSFlexGrid7 which has a "stable" sort over several sort actions.

I'll leave the question open. Probably s.o. has an answer anyway....

thanx and cheers

Choli
0

LVL 29

Expert Comment

ID: 10167423
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund

leonstryker
EE Cleanup Volunteer
0

Author Comment

ID: 10169825
....just before points are lost throug operator...

thanx anyway

Choli
0

Author Comment

ID: 10169833
btw.... I use VSFlexGrid instead of a list box or another grid. VSFlexGrid has a stable sort order what is exactly what I'm looking for...

Choli
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
###### Suggested Courses
Course of the Month19 days, 22 hours left to enroll