We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DateTimePickerAdv Null Value

Thread ID:

Created:

Updated:

Platform:

Replies:

28309 Apr 28,2005 06:58 PM UTC Apr 29,2005 04:47 PM UTC Windows Forms 1
loading
Tags: EditControl
Eric Pellegrino
Asked On April 28, 2005 06:58 PM UTC

I''m having a problem with the dattimepickeradv control. I have the datetimepicker bound to a text box to see the results of the datetimepicker. I get peculair results when I click on the ''none'' button, the bound value shown in the text box shows todays date instead of null. why would this be?

Administrator [Syncfusion]
Replied On April 29, 2005 04:47 PM UTC

Hi Eric, Since DataTime is a value type, it can''t be given a null value. Therefore, DateTimePickerAdv represents a null date with the IsNullDate property. So to have a TextBox display Null if the date is null, you need to do something like this: private void dateTimePickerAdv1_ValueChanged(object sender, System.EventArgs e) { if (this.dateTimePickerAdv1.IsNullDate) { this.textBox1.Text = "Null"; } else { this.textBox1.Text = this.dateTimePickerAdv1.Value.ToLongDateString(); } } Regards, Gregory Austin Syncfusion Inc. P.S. DateTimePickerAdv is a part of the Editor package of Tools, not Edit.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;