Hello All:
I am trying to compare the selected date (short type) in a DateTimePicker to a line from a text file. The text file contains this information:
3/21/2016 7:57:00 AM
3/21/2016 4:30:09 PM
Total Time: 8:33:09
What I need is to know if the current date (from the DateTimePicker) is after the dates listed in the text file. I have the entire program working except for this piece, and I cannot figure out how to check it line by line from the text file. This is what I have so far for this sub:
Any help with this would be greatly appreciated.Code:Sub GetRecords() Dim startDate as String = DateTimePicker1.Value.ToString("M/d/yyyy") Dim endDate as String = DateTimePicker2.Value.ToString("M/d/yyyy") Dim EMP_NAME As String = "C:\mydata.txt" Dim strReadFile As New System.IO.StreamReader(EMP_NAME) Dim line As String Do While Not strReadFile.EndOfStream line = strReadFile.ReadLine If line. ---STUCK HERE--- Then ---I need to compare the datetimepickers to the values here from the text file--- ---If the text file lines are between these dates, then add them to a text box--- Exit Do End If Loop strReadFile.Close() End Sub
DB




Reply With Quote
