Contents

DateTimePicker.Value Property

Notes

Gets or sets the underlying System.Datetime value of the control.

Check the HasValue property to ascertain whether a valid date value exists before accessing this property.

If the underlying System.Datetime value has not been set to a valid System.Datetime value, an exception will be thrown when this property is accessed.

Default value : None ( HasValue is FALSE by default )

There are 3 circumstances in which Value will not contain a valid datetime (and HasValue will return FALSE)
1.  AllowNullValue has been set to TRUE and the user has submitted a DateTime value containing one or more "unselected" items.
2.   The control is displaying first time round (on form load) and the Value property has not been specified in code.
3.   The user is using a browser other Internet Explorer 5 or greater, has submitted an invalid Date (E.g. 31 Februrary 2000), and the developer has changed InvalidMonthAndDayAction to LeaveAsInvalid.

Syntax

[Visual Basic]
Overridable Public Property Value As System.DateTime
[C#]
public virtual System.DateTime Value {get; set;}
[C++]
public: __property virtual System.DateTime get_Value();
public: __property virtual void set_Value(System.DateTime);
[JScript]
public function get Value() : System.DateTime;
public function set Value(System.DateTime);

See Also

DateTimePicker Contents | DateTimePicker Overview | DateTimePicker Members


Support | Feedback | Contact Dune5 | Website

© 2001-2003 Dune5. All Rights Reserved.