c# - Return a null value from date control

  • Thread starter Thread starter nologo
  • Start date Start date
N

nologo

Hi,

Visual Studio 2005, C#.net

I wish to return a NULL value from a date control if no date is
selected. Anyone got any idea on how i would do this?


Cheers
 
If I unsderstand... well, if you are using binding to a nullable
datetime (i.e. "DateTime?"), then it should just work automatically;
otherwise, check for DateTime.MinValue and substitute for your NULL.
In the other direction there is also a NullValue on a binding, which
is the value to display when the source is null.

Marc
 
Thanks for reply Marc, the DateTimePicker control has a mindate value
that only allows for the date format to be entered...so for example,
trying to return the value as NULL gives an error.
The mindate has a value preassigned in the date format
 
In that case, perhaps use the ShowCheckBox to indicate that no date
should be used, and look at .Checked as well as .Value?

Marc
 
Back
Top