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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DateTimePickerAdv On Demand - Defaults

Thread ID:

Created:

Updated:

Platform:

Replies:

47185 Jul 29,2006 07:21 PM UTC Aug 2,2006 05:38 PM UTC WinForms 3
loading
Tags: Tools
Tom Affholter
Asked On July 29, 2006 07:21 PM UTC

I am using a bound DateTimePickerAdv control. My data entry folks do not want to have to use the mouse to enter a student record. I have fields that need to remain null such as ''Date of Enrollment'' (for a prospect). How can I create a hot key (or other) that would set today as the default date while focused on the respect DateTimePickerAdv? Otherwise - with default text "Not Registered". I don''t want focus to set default else tabbing thru would loose my nulls. Right now the user must open the calendar to pick an initial date.

I noticed there is a keypress event handler but it appears to be useless.

Thanks

Anupama Roy [Syncfusion]
Replied On July 31, 2006 06:01 PM UTC

Hi Tom,

Currently it is not possible to create one particular key directly as the hotkey since NullModeKeyReset property that toggles the null state supports only three enums ArrowKeys,NumericKeys and Any .We have already logged a feature report regarding this and soon we will be implementing this feature for DateTimePickerAdv so that one particular key can also be specified as NullModeKeyReset.As a workaround,you can derive a custom class from DateTimePickerAdv and set in such a way that only for that specified keyData,the null date will change to present date.

public class DateTimePickerAdvance:Syncfusion.Windows.Forms.Tools.DateTimePickerAdv
{

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if(this.IsNullDate &&keyData==Keys.Enter )
{
this.Value =System.DateTime.Today ;
}

return false;


}

Please take a look at the sample attached and let us know if you have any difficulties.


Thanks for choosing Syncfusion products.

Regards,

Anu.

DateTime0.zip

Tom Affholter
Replied On August 2, 2006 02:41 AM UTC

I am coding VB but I used your idea and it works like a champ! Exactly what I wanted.

Thanks

>Hi Tom,

Currently it is not possible to create one particular key directly as the hotkey since NullModeKeyReset property that toggles the null state supports only three enums ArrowKeys,NumericKeys and Any .We have already logged a feature report regarding this and soon we will be implementing this feature for DateTimePickerAdv so that one particular key can also be specified as NullModeKeyReset.As a workaround,you can derive a custom class from DateTimePickerAdv and set in such a way that only for that specified keyData,the null date will change to present date.

public class DateTimePickerAdvance:Syncfusion.Windows.Forms.Tools.DateTimePickerAdv
{

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if(this.IsNullDate &&keyData==Keys.Enter )
{
this.Value =System.DateTime.Today ;
}

return false;


}

Please take a look at the sample attached and let us know if you have any difficulties.


Thanks for choosing Syncfusion products.

Regards,

Anu.

DateTime0.zip

Anupama Roy [Syncfusion]
Replied On August 2, 2006 05:38 PM UTC


Hi Tom,

We are glad to know that you could resolve the issue with this.

Thanks for the update.

Regards,

Anu.

>I am coding VB but I used your idea and it works like a champ! Exactly what I wanted.

Thanks

>Hi Tom,

Currently it is not possible to create one particular key directly as the hotkey since NullModeKeyReset property that toggles the null state supports only three enums ArrowKeys,NumericKeys and Any .We have already logged a feature report regarding this and soon we will be implementing this feature for DateTimePickerAdv so that one particular key can also be specified as NullModeKeyReset.As a workaround,you can derive a custom class from DateTimePickerAdv and set in such a way that only for that specified keyData,the null date will change to present date.

public class DateTimePickerAdvance:Syncfusion.Windows.Forms.Tools.DateTimePickerAdv
{

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if(this.IsNullDate &&keyData==Keys.Enter )
{
this.Value =System.DateTime.Today ;
}

return false;


}

Please take a look at the sample attached and let us know if you have any difficulties.


Thanks for choosing Syncfusion products.

Regards,

Anu.

DateTime0.zip

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

;