Sorting alphanumeric table column correctly

V

VMI

How can I sort a table column correctly when the table has values like "0",
"A1", "AA-1", "B21", "3C", 4-32A", "1", "11-1", 2-A", etc... The table will
then be loaded to a grid and that's when it'll have to sort correctly (when
clicking on the col. header).

Windows Explorer (in XP) seems to do this correctly when I sort files with
these names. In the column, I tried padding all values with 0's and the
sorting improved but it still wasn't correct.

Basically, I want to emulate the Windows XP file sorting.
Any help is appreciated.

Thanks.
 
M

Michael C

2 questions - are you trying to do this in a ListView? And what's the
expected order for the sample names you gave? I'm thinking 0, 1, 11-1, 2-A,
3C, 4-32A, A1, AA-1, B21. Is that the order you're looking for? In the
ListView, it's a fairly simple matter to define your own custom
ListViewSorter for special situations.

Thanks,
Michael C., MCDBA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top