I have a bound datetimepicker with a custom format, when I change the value of the control it kicks off the validating event, but the value in dtpLogIn_Date.Value is not the value shown on the screen. Now if I type '05' instead of '5' or if I return to the field and press tab again dtpLogIn_Date.Value will have the correct value #2/20/2019 05:00:00 AM#. Why is the form control not updating the program data when tab is pressed? is there a way to force this?
I have tried
Me.Validate()
Shift_LogBindingSource.EndEdit()
VS2015, winforms, vb.net
Code
Private Sub dtpLogIn_Date_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles dtpLogIn_Date.Validating Dim dtOldValue As DateTime = dtpLogIn_Date.Value '<- returns #2/20/2019 06:00:00 AM#
End Sub
Control def
'dtpLogIn_Date
'
Me.dtpLogIn_Date.CustomFormat = "MM/dd/yyyy h:mm tt"
Me.dtpLogIn_Date.DataBindings.Add(New System.Windows.Forms.Binding("Value", Me.Shift_LogBindingSource, "SL_LogIn_Date", True))
Me.dtpLogIn_Date.Format = System.Windows.Forms.DateTimePickerFormat.Custom
Me.dtpLogIn_Date.Location = New System.Drawing.Point(172, 71)
Me.dtpLogIn_Date.Name = "dtpLogIn_Date"
Me.dtpLogIn_Date.Size = New System.Drawing.Size(149, 20)
Me.dtpLogIn_Date.TabIndex = 4