Attempting to sort files numerically. A list of files:
1.jpg 2.jpg 3.jpg 4. jpg 10.jpg 11.jpg 20.jpg
this list would be ordered like so:
1.jpg 10.jpg 11.jpg 2.jpg 20.jpg 3.jpg 4.jpg
private void button1_Click(object sender, EventArgs e)
{
string x = txtPath.Text;
string[] path = Directory.GetFiles(x);
string[] filePaths = path;
foreach (string element in filePaths)
{
lb1.Items.Add(Path.GetFileName(element));
}
lb1.Sorted = true;
}