Remove time part from datetime in bound label control

  • Thread starter Thread starter aaa
  • Start date Start date
A

aaa

Hi

I am trying to bind Text property of label control to datetime object
(attribute from typed dataset). The problem is that I want only to show
date part. Currently I use following code:

this.dv = new DataView(this.ds.Person);
this.labelBirth.DataBindings.Add("Text", this.dv, "BirthdayDate");

When I do this, the text shown is, for example,

12.10.1990 13:25:34

What is the way to format the binded text to show only date part?

12.10.1990
 
If time is really not important, (I dunno if there is an easy way to do
this) I would manually update the Text property of the bound textbox perhaps
on a TextChanged event to display just the shortdatestring format of the
birthdate (datetime.ToShortDateString()).

One of the reasons why I hate databindings...
 
Back
Top