Hi,
this is not really an LLBLGen issue but as you're all so helpful I thought I'd give it a go!
I'm binding date fields from entity objects and formatting the output in the text box in short date format.
BindDateField(Me.txtCheckIn, "Text", reservation.BookingDetail, "CheckIn")
BindDateField(Me.txtCustTravleDate, "Text", reservation.BookingDetail, "CheckIn")
BindDateField(Me.txtCheckOut, "Text", reservation.BookingDetail, "CheckOut")
Public Sub BindDateField(ByVal control As Control, ByVal propertyName As String, ByVal dataSource As Object, ByVal dataMember As String)
For index = control.DataBindings.Count - 1 To 0 Step -1
dbd = control.DataBindings.Item(index)
If dbd.PropertyName = propertyName Then
control.DataBindings.Remove(dbd)
End If
Next
dbd = New Binding(propertyName, dataSource, dataMember)
control.DataBindings.Add(dbd)
End Sub
Private Sub oBinding_Format(ByVal sender As Object, ByVal e As System.Windows.Forms.ConvertEventArgs) Handles dbd.Format
e.Value = Format(e.Value, "D")
End Sub
When I run the app. the dates in the textboxes are formatted correctly, however the textboxes are on a tab control and when I click onto a different tab and then back all the dates show in the format 01/01/2005 00:00:00.
Any ideas?
Rob.