Contents

DateTimePicker.HasValue Property

Notes

Gets a boolean value indicating whether the control's DateTime Value property contains a valid Datetime value.

NB Always check HasValue before getting the Value property.  ( Getting the Value property when HasValue is FALSE causes an Exception to be thrown )

Circumstances in which HasValue will return FALSE
1.   AllowNullValue is TRUE and the user has submitted a DateTime value containing one or more "unselected" items.
2.   The user has submitted an invalid DateTime (E.g. 31 Februrary 2000) and InvalidMonthAndDayAction is LeaveAsInvalid.
3.   The control is displaying first time round ( not on Postback ) and the Value property has not been specified in code.

Syntax

[Visual Basic]
Overridable Public Readonly Property HasValue As Boolean
[C#]
public virtual bool HasValue {get;}
[C++]
public: __property virtual bool get_HasValue();
[JScript]
public function get HasValue() : bool;

See Also

DateTimePicker Contents | DateTimePicker Overview | DateTimePicker Members


Support | Feedback | Contact Dune5 | Website

© 2001-2003 Dune5. All Rights Reserved.