Solved

Sorting???

Posted on 1998-11-01
1
179 Views
Last Modified: 2013-11-20
Dear All,

I have done a sorting of a listview by using the function
CListCtrl::SortItems();.
My listview contain 4 columns:
tel no, first name, last mail, email.

The problem I faced now is :
Many people will have the same last name/ first name.
Thus when I am doing the sorting accoring to the first name,
eg. tel no   first name    last name
    999999   Peter
    888888   Peter
    222231   Peter
    982732   Peter
    777929  Peter

The tel no will not be sorted in ascedning order.
How can I implemnt like this:
eg. tel no   first name    last name
    222231   Peter
    777929   Peter
    888888   Peter
    982732   Peter
    999999  Peter

Thanks...
0
Comment
Question by:ee_lcpaa
1 Comment
 
LVL 10

Accepted Solution

by:
RONSLOW earned 40 total points
ID: 1324123
simply write your comparison function to return -1/0/+1 based on first name, then, if names are equal, compare telephone numbers.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

20 Experts available now in Live!

Get 1:1 Help Now