Hello all;
I am new to vb2010 express and was wondering if I may get some help.
I am attempting to obtain the names of the files in a folder (without their extensions) by the last date they are modified.
I only need to get the most recent 6 of them. I am then ading them to the ToolStripTextBox menu as a quick link to open them.
This is what I have thus far:
This part returns 6 of the same file name. What am I doing wrong? Anyone care to help?
I appreciate all help.
I am new to vb2010 express and was wondering if I may get some help.
I am attempting to obtain the names of the files in a folder (without their extensions) by the last date they are modified.
I only need to get the most recent 6 of them. I am then ading them to the ToolStripTextBox menu as a quick link to open them.
This is what I have thus far:
Code:
Public Sub Get_Recent_File()
Dim x As Integer = 1
Dim infoReader As System.IO.FileInfo
Do
For Each fileFound As String In My.Computer.FileSystem.GetFiles(Recipes_Path)
infoReader = My.Computer.FileSystem.GetFileInfo(fileFound)
If FormatDateTime(Now, DateFormat.ShortDate) >= FormatDateTime(infoReader.LastWriteTime, DateFormat.ShortDate) Then
RF(x) = System.IO.Path.GetFileNameWithoutExtension(fileFound)
End If
Next
x = x + 1
Loop Until x = NumRecentFavorites
End SubI appreciate all help.