Avatar of Member_2_7964482
Member_2_7964482

asked on 

VB.Net - shortcut to obtaining most recent file

Trying to find the most recent file with the following code:

 Dim FileList = New DirectoryInfo(SummaryDir).GetFiles(Fin + "*.xls").OrderByDescending(Function(x) x.CreationTime)
        For Each f As FileInfo In FileList
            lastfile = f.Name
            Exit For
        Next

Is there a way to avoid the for/next to obtain the last filename?
Visual Basic.NET

Avatar of undefined
Last Comment
Member_2_7964482

8/22/2022 - Mon