The user is selecting multiple files
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Multiselect = true;
DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog.
int id = RadarGraphInsertDLL.SalesDWH.Return_Last_QuickLabDumpID();
if (result == DialogResult.OK) // Test result.
{
foreach (string file in openFileDialog1.FileNames)
{
/////
I would like the foreach to work on the files in order of MODIFIED DATE
How do I grab the files by modified date?
Try using this to order the list of files:
EDIT – Ordering clarification
In this case,
.OrderBywill order the file names in terms of the oldest modified file first. To order in terms of the most recently modified file first, use.OrderByDescendinginstead.