Solved

Sorting a listbox with more then one sort-level

Posted on 2003-12-01
8
193 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

705 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