Results 1 to 12 of 12

Thread: [RESOLVED] Comparing DateTimePicker to text file data?

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2014
    Posts
    24

    Resolved [RESOLVED] Comparing DateTimePicker to text file data?

    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:

    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
    Any help with this would be greatly appreciated.

    DB
    Last edited by davebowlin; Jun 7th, 2016 at 03:16 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width