matrix717
asked on
How to sort the ListView?
I'm using a list view control for a FTP client program. I add all the files to the ListView in Report Style and add pictureA if its a file or PictureB if its a folder. How can I sort the list but first the folders and then the Files just like in Windows Explorer?
thanks
thanks
ASKER
how can I order an array alphabeticaly?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
aikimark,
wouldn't that give you a listing order of
d_dirname1
d_dirname2
d_dirname3
f_filename1
f_filename2
f_filename3
f_filename4
I think you are on the right track however.
I would add a number to the front of your descriptor which will be the order in which they are to be listed.
1d_dirname1
2d_dirname2
3f_filename1
4d_dirname3
5f_filename1
6f_filename2
7f_filename3
8d_dirname4
Just a thought
wouldn't that give you a listing order of
d_dirname1
d_dirname2
d_dirname3
f_filename1
f_filename2
f_filename3
f_filename4
I think you are on the right track however.
I would add a number to the front of your descriptor which will be the order in which they are to be listed.
1d_dirname1
2d_dirname2
3f_filename1
4d_dirname3
5f_filename1
6f_filename2
7f_filename3
8d_dirname4
Just a thought
Add space (" ") to folder names.
string data is sorted in left-to-right sequence.
1. all the "d_" items will appear before any "f_" item.
2. the strings (names) within each "group" will appear in their correct alphabetic sequence.
"try it...you'll like it" :-)
(quote from an old Alka Seltzer commercial)
1. all the "d_" items will appear before any "f_" item.
2. the strings (names) within each "group" will appear in their correct alphabetic sequence.
"try it...you'll like it" :-)
(quote from an old Alka Seltzer commercial)
Example of what you should see:
d_alongdirectoryname
d_bnatural
d_csharp
f_notadirectory
f_plentyoftheseonyourhardd rive
f_seethepatternyet
f_thisisthelastthingtosort inyourlist view
d_alongdirectoryname
d_bnatural
d_csharp
f_notadirectory
f_plentyoftheseonyourhardd
f_seethepatternyet
f_thisisthelastthingtosort
I think I missunderstood what he was wanting.
I thought he was wanting a TreeView but without using the TreeView control.
I thought he was wanting a TreeView but without using the TreeView control.
ASKER
I repeat, what I want is to sort the files and folders just as Windows Explorer does...
Folder AAA
Folder AAB
Folder CCA
File AA
File AB
I want to press the header and that the files an folders of that column get sort on that way...
Folder AAA
Folder AAB
Folder CCA
File AA
File AB
I want to press the header and that the files an folders of that column get sort on that way...
Hope it helps.
I did try several ideas to order listviews and none was enought.