Vb.net Read Directory Files Order by Lastwritetime

You are using an out of engagement browser. It may non display this or other websites correctly.
Y'all should upgrade or utilise an alternative browser.

Sort files by Date, Name using Directory.GetFiles()

  • Thread starter timcurtin
  • Start appointment
  • #1

Howdy All,

I am working on a Windows Desktop application and I need to sort the files past date and or proper name in both assending / descending order. Can someone help me out with the line of code to implement this?

I currently accept this code in place which is working only has no function to sort as I am seeking to exercise. NOTE: This code is ruhning within of a BackgroundWorker

                          'GETS ALL OF THE SPECIFIED IMAGE FILE TYPES (JPG, TIF, PNG)         'FROM THE SELECTED Binder 'DirPath'          Endeavor              DirFiles = Directory.GetFiles(DirPath, AllowedExt(eNDX))             Dim fCount As Integer = 0             P1Max = DirFiles.Count             P1Val = 0              i = 0             STR = ""             TMPstr = ""             ImgFile = ""              For Each DirFile In DirFiles                  BW1.ReportProgress(i)              Next           Catch ex As Exception              MessageBox.Evidence("BW1_DoWork Mistake" & vbCrLf & _                       ex.Bulletin & vbCrLf & _                       "i = " & i)              BW1.CancelAsync()             Leave Sub           End Try                        

Hopefully I figured out how to "properly" paste source lawmaking into this equally I was spanked by a moderator for this some time ago and have shyed away from this due to his reproach. harsh ti was. harsh.

Last edited by a moderator:

jmcilhinney

  • #2

Firstly, please use formatting tags when posting code. As you tin can encounter, it'south much easier to read.

As for the question, if you want to be able to sort the files by name and date and so I suggest using the DirectoryInfo and FileInfo classes instead. DirectoryInfo.GetFiles will render an array of FileInfo objects, which incorporate both the file names and create/modification dates. If you use Directory.GetFiles and so you get a String array and you lot take to phone call a separate method for each file path to become the appointment you want.

There are some issues with your code too. Firstly, what's the bespeak of the progress? By the time you lot get-go reporting progress you already accept all the files, so yous've really finished doing all the work. You then waste material time reporting progress that really just counts the files and doesn't actually do annihilation with them. Your Catch block is all wrong too. Y'all're showing a message box on a secondary thread, so the user could simply get out it there indefinitely and keep using the main form. The CancelAsync call and the Exit argument do zero useful either.

How exactly you determine what to sort by and how is upwards to you but here's an example that can sort by either column, both or neither and in either management:

Imports Arrangement.IO  Public Grade Form1      Private files As FileInfo()      Private nameDirection As SortOrder = SortOrder.None     Private dateDirection As SortOrder = SortOrder.None      Individual Sub Form1_Load(sender Every bit Object, due east Equally EventArgs) Handles MyBase.Load         Me.files = New DirectoryInfo(My.Computer.FileSystem.SpecialDirectories.MyDocuments).GetFiles()     End Sub      Individual Sub Button1_Click(sender As Object, e Every bit EventArgs) Handles Button1.Click         Array.Sort(Me.files, AddressOf CompareFileInfos)     Stop Sub      Private Part CompareFileInfos(file1 As FileInfo, file2 Equally FileInfo) Every bit Integer         Dim result = 0          Select Case nameDirection             Case SortOrder.Ascending                 effect = file1.Proper name.CompareTo(file2.Name)             Example SortOrder.Descending                 upshot = file2.Name.CompareTo(file1.Name)         End Select          If issue = 0 Then             Select Instance dateDirection                 Case SortOrder.Ascending                     result = file1.LastWriteTime.CompareTo(file2.LastWriteTime)                 Case SortOrder.Descending                     result = file2.LastWriteTime.CompareTo(file1.LastWriteTime)             Finish Select         End If          Return issue     End Office  End Form
  • #3

Hello Jm..., Non sure what your name is but I greatly appreciate your reply. Let me outset explicate or perhaps re-explain a few central noteworthy pieces of information virtually myself. I am legally blind and have been so since historic period 6. So I use "assistive" or sometimes as well referred to every bit "adaptive" technology products on my PC and soon, Mac, to read the screen text and in some cases, have information technology read to me via TTS. This makes it a bit more challenging to read information, in particular large amounts of information. Regarding the formatting tags, I actually tried to figure it out and thought I had information technology, but when I clicked the upper left button to show "source code" it did non work equally I expected. So if yous can provide me with a clue on this I'd as well appreciate information technology.

Regarding the "MessageBox.Show" in the Catch section of the Try, I am using this simply to take hold of some exceptions without crashing the program. In fact it takes focus and I cannot simply conintuie on as y'all indicated without clicking the OK button. Once I am done, this volition be modified.

I will try to implement the instance and hopefully it will work out. Thanks again.

Best regards,

Tim.

jmcilhinney

  • #four

I guess y'all're visual impairment makes my annotate nigh being able to come across how much easier formatted lawmaking is to read rather moot. :) In society to format your code, you can type the formatting tags yourself or use the push button on advanced editor. That button displays the text "wrap [xcode] tags effectually selected text". It will and then pop upward a dialogue for you to enter the selection, which should be "vb" without quotes.

Equally for your message box, a modal dialogue is simply modal with respect to the thread that created information technology. I just tested to confirm and plant that, if I called MessageBox.Show in the DoWork event handler of a BackgroundWorker then I could even so select and move the form it was called from. I can't see any reason why it would exist different for y'all.

  • #5

Hi JM...

I have to tell you, I have no freak'due north agreement of how to use the tag. I have tried adding

but when I look at it is nevertheless not formatted. To avoid time to come Forum spankings, tin can you please provide me with an explicit instance. I tried your code and it works for the most part but the output when I set the "dateDirection" value to Descending shows the files in the descending order with the exception of placing the file y'all'd await at the top of the list, at the lesser. Run into screen shot attached. If that works I hope.

I'll send you lot the code once I understand how to add the tags more clearly. Thanks. Screenshot beneath (I hope that is)

File_Sort_Test.png

Well, I'll try the code tag but am not hopeful. Allow me know how it looks on your end delight.

                          [FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Imports [/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two] System.IO[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii]  [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]Public [/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff]Class[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=ii][Color=#2b91af]Form1[/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT] [FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af][FONT=Consolas][SIZE=2][Color=#2b91af] [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii]      [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]Dim[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=ii] Files [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]As[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af][FONT=Consolas][SIZE=ii][COLOR=#2b91af]FileInfo[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]()[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]      [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]Dim[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] SortNames [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]Every bit[/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][Color=#2b91af][FONT=Consolas][SIZE=two][Colour=#2b91af]SortOrder[/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] = [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][Colour=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]SortOrder[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2].None[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii]      [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]Dim[/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] SortDates [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Color=#0000ff]Equally[/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][Color=#2b91af]SortOrder[/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2] = [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#2b91af][FONT=Consolas][SIZE=two][Colour=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]SortOrder[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=ii].None[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2]      [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] SortSizes [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Equally[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=ii][Color=#2b91af]SortOrder[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] = [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#2b91af][FONT=Consolas][SIZE=two][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]SortOrder[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2].None[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii]       [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]Dim[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] DirPath [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff]As[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]String[/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii] = [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=ii][COLOR=#a31515][FONT=Consolas][SIZE=2][Color=#a31515]""[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT] [FONT=Consolas][SIZE=2][Color=#a31515][FONT=Consolas][SIZE=2][Colour=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515] [/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2]     [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Dim[/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2] i [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]As[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af]Int32[/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] = 0[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two]          [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Private[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]Sub[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] Form1_Load(sender [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff]As[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]Object[/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2], e [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff]As[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][Color=#2b91af]EventArgs[/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]) [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]Handles[/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=ii] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]MyBase[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2].Load[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]       [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff]End[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Sub[/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT] [FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff] [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]      [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=two][COLOR=#0000ff]Individual[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] Button1_Click(sender [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=two][Color=#0000ff]As[/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]Object[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2], e [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Color=#0000ff]Equally[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=ii][Colour=#2b91af]EventArgs[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two]) [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Handles[/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=ii] Button1.Click[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii]           [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#008000][FONT=Consolas][SIZE=ii][Colour=#008000][FONT=Consolas][SIZE=2][Colour=#008000]'Me.files = New DirectoryInfo(My.Computer.FileSystem.SpecialDirectories.MyDocuments).GetFiles()[/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT] [FONT=Consolas][SIZE=2][Colour=#008000][FONT=Consolas][SIZE=2][Color=#008000][FONT=Consolas][SIZE=2][Colour=#008000] [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2]          [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#008000][FONT=Consolas][SIZE=2][COLOR=#008000][FONT=Consolas][SIZE=2][Color=#008000]'FBDialog.ShowDialog()[/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/Color][/SIZE][/FONT] [FONT=Consolas][SIZE=2][Color=#008000][FONT=Consolas][SIZE=ii][Color=#008000][FONT=Consolas][SIZE=two][COLOR=#008000] [/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2]         [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#008000][FONT=Consolas][SIZE=two][Colour=#008000][FONT=Consolas][SIZE=ii][COLOR=#008000]'DirPath = FBDialog.SelectedPath[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT] [FONT=Consolas][SIZE=2][Color=#008000][FONT=Consolas][SIZE=2][COLOR=#008000][FONT=Consolas][SIZE=ii][COLOR=#008000] [/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2]        DirPath =  [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=two][Color=#a31515]"K:\GEOTAG\2013-12-12-iPhone Moving"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT] [FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][Color=#a31515][FONT=Consolas][SIZE=2][Colour=#a31515] [/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]          [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][Color=#008000][FONT=Consolas][SIZE=2][Colour=#008000][FONT=Consolas][SIZE=2][COLOR=#008000]'SET THE SORT Lodge By DATE AND/OR NAME[/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT] [FONT=Consolas][SIZE=2][COLOR=#008000][FONT=Consolas][SIZE=2][Colour=#008000][FONT=Consolas][SIZE=2][Colour=#008000] [/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]        SortDates =  [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af]SortOrder[/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=ii].Descending[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]          [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#008000][FONT=Consolas][SIZE=ii][Color=#008000][FONT=Consolas][SIZE=two][COLOR=#008000]'SortNames = SortOrder.Ascending[/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT] [FONT=Consolas][SIZE=2][COLOR=#008000][FONT=Consolas][SIZE=two][Color=#008000][FONT=Consolas][SIZE=2][Colour=#008000] [/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]         [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][COLOR=#008000][FONT=Consolas][SIZE=2][Color=#008000][FONT=Consolas][SIZE=2][COLOR=#008000]'izeDirection = SortOrder.Descending[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT] [FONT=Consolas][SIZE=2][Color=#008000][FONT=Consolas][SIZE=ii][COLOR=#008000][FONT=Consolas][SIZE=2][Colour=#008000] [/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=ii]            Files =  [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff]New[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=two][Color=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af]DirectoryInfo[/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2](DirPath).GetFiles([/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#a31515][FONT=Consolas][SIZE=ii][Color=#a31515][FONT=Consolas][SIZE=2][Color=#a31515]"*IMG*.JPG"[/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii])[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2]          [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af]Array[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=two].Sort(Files, [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][Color=#0000ff][FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff]AddressOf[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] CompareFileInfos)[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2]           [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Each[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two] Item [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]In[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=two] Files[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]             TextBox1.Text &= Files(i).Name & vbTab &  [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#a31515][FONT=Consolas][SIZE=ii][COLOR=#a31515][FONT=Consolas][SIZE=2][Color=#a31515]"|    "[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii] & _[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]                   [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#a31515][FONT=Consolas][SIZE=two][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515]"Size: "[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] & Format(Files(i).Length, [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][Color=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515]"###,### bytes"[/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]) & vbTab & [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#a31515][FONT=Consolas][SIZE=2][Colour=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515]"|    "[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] & _[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2]                  [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][Color=#a31515][FONT=Consolas][SIZE=two][COLOR=#a31515]"Date: "[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] & Files(i).CreationTime & vbCrLf[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]              i += 1           [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]Side by side[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT] [FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff] [/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2]      [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]End[/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT] [FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff] [/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]      [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][Color=#0000ff][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=two] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Function[/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two] CompareFileInfos(file1 [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Color=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff]Every bit[/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=two][COLOR=#2b91af][FONT=Consolas][SIZE=ii][Colour=#2b91af]FileInfo[/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2], file2 [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Every bit[/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#2b91af][FONT=Consolas][SIZE=2][Color=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]FileInfo[/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2]) [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT] [FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff] [/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]         [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Dim[/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii] event = 0[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii]           [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff][FONT=Consolas][SIZE=two][COLOR=#0000ff]Select[/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]Case[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] SortNames[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two]              [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff]Case[/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][Color=#2b91af]SortOrder[/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2].Ascending[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]                 result = file1.Name.CompareTo(file2.Name)               [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]Case[/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][Colour=#2b91af][FONT=Consolas][SIZE=two][Color=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af]SortOrder[/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=ii].Descending[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]                 outcome = file2.Name.CompareTo(file1.Name)           [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][Color=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]End[/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=ii][Color=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]Select[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT] [FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff] [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]          [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2] issue = 0 [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]Then[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT] [FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff] [/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=ii]             [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Select[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Instance[/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=ii] SortDates[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2]                  [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=two][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Case[/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af]SortOrder[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii].Ascending[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]                     result = file1.LastWriteTime.CompareTo(file2.LastWriteTime)                   [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Case[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][Color=#2b91af]SortOrder[/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two].Descending[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2]                     consequence = file2.LastWriteTime.CompareTo(file1.LastWriteTime)               [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Select[/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT] [FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff] [/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]              [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=ii][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]If[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] issue = 0 [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]And then[/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT] [FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff] [/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]                 [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=ii][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Select[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=two] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Case[/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two] SortSizes[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two]                      [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff]Case[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][Colour=#2b91af]SortOrder[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2].Ascending[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]                         outcome = file1.Length.CompareTo(file2.Length)                       [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff]Case[/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][Colour=#2b91af][FONT=Consolas][SIZE=two][COLOR=#2b91af][FONT=Consolas][SIZE=two][Color=#2b91af]SortOrder[/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2].Descending[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=two]                         event = file2.Length.CompareTo(file1.Length)                   [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][Color=#0000ff][FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]Cease[/COLOR][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=two][Color=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff]Select[/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT] [FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff] [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii]             [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Stop[/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT] [FONT=Consolas][SIZE=ii][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff] [/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2]         [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=two][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]End[/Colour][/SIZE][/FONT][/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=ii] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][Color=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT] [FONT=Consolas][SIZE=two][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff] [/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=ii]             [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Return[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] result[/SIZE][/FONT][/SIZE][/FONT] [FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2]      [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=two][Color=#0000ff]Finish[/Colour][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][FONT=Consolas][SIZE=two][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Function[/Color][/SIZE][/FONT][/Color][/SIZE][/FONT][/Colour][/SIZE][/FONT] [FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=two][Colour=#0000ff] [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]Terminate [/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=ii][FONT=Consolas][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=ii][Color=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff][FONT=Consolas][SIZE=2][Colour=#0000ff]Form[/Colour][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT] [FONT=Consolas][SIZE=2][Color=#0000ff][FONT=Consolas][SIZE=ii][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/FONT][/Color][/SIZE][/FONT][/COLOR][/SIZE][/FONT]                        
  • #half dozen

Hi Again JM...

The screenshot showed up simply the lawmaking is still unformatted. Do I have to add together some blazon of <P> tage inside of the XCODE tag? Also, can I simply type the

in the regular reply instead of using the "Become Advanced" button?

Let me know well-nigh the code if you can read the crappy formatting too. Thanks again. Beingness low vions is a hurting but just in that it takes longer to read and causes some fatigue. But I'm not wimpering, as well much that is :)

jmcilhinney

  • #vii

Whether you lot type the formatting tag or employ the button on the toolbar of the advanced editor, y'all need to specify an option, which determines what formatting rules to use. To format VB code, that option needs to be VB. I'chiliad not sure what your screen reader can and tin can't read successfully but let me spell it out. The opening tag starts with a bracket, and then the word xcode, so an equals sign, and so the pick, then a closing bracket. When I say bracket I do truly mean bracket, not parenthesis or chevron or brace or anything else. A true bracket is what some refer to as a square bracket.

jmcilhinney

  • #8

Your screenshot in mail service #five suggests that you lot have sorted the files in descending social club by name first, so whatever other condition volition take no effect because no ii names are alike. If you lot want to sort past just engagement then you have to ensure that all the other sort directions are set to None.

  • #9

OK. So I'd type the post-obit, correct?

                        the code goes here that I pasted                      

Also, is there a mode to paste a screehshot into the edit window rather than creating the image past copying the clipboard into an paradigm editor, saving it every bit a PNG and then attaching it as I did in the previous postal service?

Thanks for all your assist on the TAG tasks. BTW, did yous get a gamble to look at the code and the screenshot I sent last post? Did yous see what I was talking nigh regarding the concluding file in the sorted list (Sort Date Descending) is at the bottom when it should be at the tiptop?

Thanks once again.

jmcilhinney

  • #10

It appears that the option for the XCODE tag has to be lower case. With regards to images, you can only attach them or include URLs to images on other servers. As for the code, I addressed the outcome in post #8.

  • #11

Hullo JM...

Follow up question on my sort needs. The lawmaking is working fine merely in this projection I am collecting all JPG files from a user selected binder "DirPath" and then populating a ListView1 control with each image and Files(I).Name. The problem is that I really need to sort the images based on their embedded EXIF metadata which I am grabbing during a For Loop processing sub routine. The result of the routine is placed in an Object Array called GeoImg(15). Element 2 (Index 1) holds the FullName / Path wher the image is located and Index 10 holds the "Date Taken" Engagement/Time metadata extracted from the image during processing. And so while a JPG file might bear witness the File.CreatedTime equally one date, the actual appointment is dissimilar based on the FileInfo grab of the datetime information. Then I want to sort the GeoImg() array based on index 10 in either ascending or descending order depending on the user's preference. Any thoughts on an approach to best sort this Assortment?

As ever, thank you.

Tim

jmcilhinney

  • #12

Don't utilize an Object assortment. VB.Net is an object-oriented linguistic communication then make apply of that, i.due east. define a class. Your form would have 1 or more than properties for the EXIF data so either i property for the FileInfo object or multiple backdrop for the important property values from the FileInfo object, e.thousand.

Public Class ImageFileInfo     Public Holding FileInfo() As FileInfo     Public Property ExifDate() Equally Appointment End Class

If you and so have a list of instances of that type you tin can order them past property values or subproperty values, e.g.

Dim byDate = myImageFileInfos.OrderBy(Function(ifo) ifo.ExifDate) Dim byName = myImageFileInfos.OrderBy(Function(ifo) ifo.FileInfo.Name)
  • #thirteen

OK. Well, I have to say, even though I've been programming off and on since 1984, beginning with the Apple 2C, and later in the early ninety's with C, ALC, COBOL, QBasic iv.five and in 1995, Visual Basic , y'all are apparently better at it than I am. I have had to adopt the trial and fault method for most of that time due to a lack of assistive technologies dorsum then, and of course at present it is easier for folks with vision impairments to obtain information, just withal, VB has changed then much in the by 20 years, better in fact. This projection, which started out to exist pretty piece of cake is turning into an educational lesson. While equally y'all can imagine, there are more than one way to skin a cat or approach codeing a solution but some of the ways yous are showing me are truly better approaches and take advantages of the OOPs platform. So bear with me man merely I greatly appreciate your assist.

Talk later.

Tim

kimwainvis.blogspot.com

Source: https://vbdotnetforums.com/threads/sort-files-by-date-name-using-directory-getfiles.59658/

0 Response to "Vb.net Read Directory Files Order by Lastwritetime"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel