I have this part of the code:

private void button3_Click(object sender, EventArgs e) { FolderBrowserDialog FBD = new FolderBrowserDialog(); if (FBD.ShowDialog() == DialogResult.OK) { foreach (string file in Directory.GetFiles(FBD.SelectedPath)) { listView1.Items.Add(file.ToString()); listView1.Items.Add(file); } foreach (string item in Directory.GetDirectories(FBD.SelectedPath)) { listView1.Items.Add(item.ToString()); listView1.Items.Add(item); 

Tell me, how can I make sure that after I display the contents of the selected folders and subfolders in the listView, the contents can be sorted by date, size and file type?

1 answer 1

The answer to the question with examples of the sorting code is on the site of the microsoft:

https://support.microsoft.com/en-us/kb/319401

But here:

https://stackoverflow.com/questions/1548312/sorting-a-listview-by-column

It is advised to use a non-standard component, which is much easier to use ... Including there is the possibility of sorting without additional code.

Link to the component itself: http://www.codeproject.com/KB/list/objectlistview.aspx