Hi guys,
I need to sort an array by date created.
Please take a look at this code thus far
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace listboxarraysortexample
{
public partial class Form1 : Form
{
string[] dirs;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
dirs = Directory.GetFiles("C://jpegs");
listBox1.Items.Clear();
foreach (string file in dirs)
{
string filename = Path.GetFileName(file);
listBox1.Items.Add(filename);
}
}
}
}
Before I add the items to the list box I want it to build the string array in accordance with teh file create date which the directory info collects.
I realise Im not the best coder in the world however I usually manage to find away, but this beats me. I have tried various appraoches like using the icomparer but none of the example code I looked at help me out.I know that the answe is proabably really easy, can anyone help me?
Thank you in advance