I have the following as an example:
01 Aug 2016 @ 14:16 as a text string in a text box. It is not formatted as a datetime field but simply as a text string. This is because of the way the users enter data into a PDF (as shown above) and that is imported as a text string...
1st thing I am trying to do is strip off the date and only have the time (14:16) and will call that "result1". I believe I have conquered that (see code below).
Then I want to take that result (14:16) and compare it to an actual formatted datetime field which contains only a time with no date, 14:00 as an example, and will call that "result3". I am looking to see if "result3" is greater (or after) "result1".
My major issue is properly getting the time only field (result3) to show just the time. It is returning the following when running via debug:
System.Windows.Forms.TextBox, Text: 14:00
and I need it to return only "14:00" without the "System.Windows.Forms.TextBox, Text:".
One of the two results is formatted incorrectly, I suspect, but not sure which. Should I convert result1 to a datetime string after extracting the portion I need or should I convert result3 to a text string? My thinking is both should be datetime since I am looking to see if result3 is after result1.
I'm certain this is a formatting issue but unsure how to get the datetime box (result3) to read properly and/or converting a text field (result1) to a datetime (time only) result for comparison.
Man, I hope that makes sense...
Last Request: Am I doing the CASE comparison properly?
What I have tried:
Private Sub tb01Time_TextChanged(sender As Object, e As EventArgs) Handles tb01Time.TextChanged
Dim result1 As String = tb01Time.ToString
Dim result2 As String = LoadRight(result1, 5)
Dim result3 As String = tbShipArriveTime.ToString
Dim late As String
If result3 > result2 Then
late = "True"
Else
late = "False"
End If
Select Case tbShipArriveTime.ToString
Case = "True" : tb01Time.BackColor = Color.Red
tb01Time.ForeColor = Color.White
Case Else : tb01Time.BackColor = Color.White
tb01Time.ForeColor = Color.Black
End Select
End Sub