Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Sorting a listbox with more then one sort-level

Posted on 2003-12-01
8
Medium Priority
?
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Accepted Solution

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

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

618 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