Solved

Sorting a listbox with more then one sort-level

Posted on 2003-12-01
8
184 Views
Last Modified: 2010-05-03
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
Comment
Question by:Choli
  • 4
  • 3
8 Comments
 
LVL 4

Expert Comment

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

Author Comment

by:Choli
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

by:Clothahump
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

by:
Clothahump earned 250 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Choli
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

by:leonstryker
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
 
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

leonstryker
EE Cleanup Volunteer
0
 

Author Comment

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

thanx anyway

Choli
0
 

Author Comment

by:Choli
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now