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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top