Solved

Sorting a listbox with more then one sort-level

Posted on 2003-12-01
8
182 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

743 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

15 Experts available now in Live!

Get 1:1 Help Now