Hi,
If you have a databound textbox you can use the format event. Add a
handler after you bind the textbox. The textbox format event will fire the
next time the control redraws or the data changes.
txtDate.DataBindings.Add("Text", dvInvoice, "BillDate")
AddHandler txtDate.DataBindings(0).Format, AddressOf Me.FormatDate
===========The procedure===========
Private Sub FormatDate(ByVal sender As Object, ByVal e As ConvertEventArgs)
Dim dt As Date
Try
dt = e.Value
e.Value = dt.ToShortDateString 'Format(e.Value, "MMM d, yyyy")
Catch
e.Value = "Unknown"
End Try
End Sub
Ken
----------------------------
"Jan Nielsen" <Re**************@tiscali.dk> wrote in message
news:ea**************@tk2msftngp13.phx.gbl...
Hi
I have a dataform that shows a date from a MSDE 2000 in a textbox.
It uses the format: dd-mm-yyyy hh:mm:ss
It would it to use the format dd-mm-yyyy
But I can't find a Format property for the textbox.
So I tried in the VB code the wizard generates
Me.editDateOfBirth.DataBindings.Add(New
System.Windows.Forms.Binding("Text", Me.objDSBoerneKirken, "tPersoner.DateOfBirth"))
Me.editDateOfBirth.Location = New System.Drawing.Point(120, 604)
Me.editDateOfBirth.Name = "editDateOfBirth"
Me.editDateOfBirth.TabIndex = 37
Me.editDateOfBirth.Text = ""
' Me.editDateOfBirth.Text.Format("short date") My addition that does not
work
Any suggestions?
Best regards
Jan Nielsen