The code below creates a list of strings that I would like to sort by date, but there are 2 problems. First, the date is within the string, but it can be grabbed by splitting the string and grabbing the 3rd segment - Results(x).Split(""""c)(3)
. The string is being split by quotes. Second, the date will contain a string like this 7/21/2019 or 11/9/2019. I think this might be an issue because it's not mm/dd/yyyy. Month or Day could be 1 or 2 characters (not sure if that really matters).
I am thinking DateTime.Compare and DateTime.Parse would be used, but I'm not sure how I would use them to get the list in order of date. The list will contain strings that look like this...
In the code below, the date for the first item in the List is outputted, but I want to sort the List by date. Does someone know how this can be done? Thanks!
Private Sub btnSaveReport_Click(sender As Object, e As EventArgs) Handles btnSaveReport.Click
Dim strSourceFileLocation As String = AppDomain.CurrentDomain.BaseDirectory + "_data/"
Dim strDetinationFileLocation As String = tbSaveFileLocation.Text
Dim Paths() As String = IO.Directory.GetFiles(strSourceFileLocation, "*.code")
Dim Results As New List(Of String)()
For Each Path As String In Paths
For Each line As String In File.ReadAllLines(Path)
If line.Contains("RAS-") Then
Dim strDate As String = Results(0).Split(""""c)(3)
Catch ex As Exception