PC Review


Reply
Thread Tools Rate Thread

DateTime Field

 
 
Ryan
Guest
Posts: n/a
 
      17th Oct 2006
My form includes a field of the DateTime type. I want to allow the user to
be able to set both the date and the time. By default the DateTimePicker
shows just the date and calendar, the time is autoset to 12:00 PM. How's
the best way to do this?

I tried creating a custom format which displays both the date and time and
turned on the Up Down option (DateTimePicker.ShowUpDown). This works but is
a bit clunky. The user has to click on each part of the field and then
either use the keyboard up down arrows or mouse-click the Up or Down arrows
on the control. I prefer my forms to be fully completable without the mouse
(though I do like mouse options available for those who want them). Tabbing
abandons the control rather than moving to the next portion of the field and
I don't see any way to control this behavior.

Another option I considered is 2 DateTimePicker controls on the form, both
tied to the same field, one for the Date and one for the Time. The problem
I forsee is that the data from each control could conflict. Just because
the date and time aren't displayed in each control doesn't mean they aren't
there.

Any tips appreciated.. thanks.

Ryan


 
Reply With Quote
 
 
 
 
Ryan
Guest
Posts: n/a
 
      17th Oct 2006
Ok for now what I decided to do was split the date and time into 2 fields.
Each field actually stores a date and time well because that's the way
Microsofts datetime field works, but the other stat is ignored (in other
words if its my date field the time portion is ignored and visa versa).
I'll go with this but still open to other suggestions.

"Ryan" <(E-Mail Removed)> wrote in message
news:Ol4%(E-Mail Removed)...
> My form includes a field of the DateTime type. I want to allow the user
> to be able to set both the date and the time. By default the
> DateTimePicker shows just the date and calendar, the time is autoset to
> 12:00 PM. How's the best way to do this?
>
> I tried creating a custom format which displays both the date and time and
> turned on the Up Down option (DateTimePicker.ShowUpDown). This works but
> is a bit clunky. The user has to click on each part of the field and then
> either use the keyboard up down arrows or mouse-click the Up or Down
> arrows on the control. I prefer my forms to be fully completable without
> the mouse (though I do like mouse options available for those who want
> them). Tabbing abandons the control rather than moving to the next
> portion of the field and I don't see any way to control this behavior.
>
> Another option I considered is 2 DateTimePicker controls on the form, both
> tied to the same field, one for the Date and one for the Time. The
> problem I forsee is that the data from each control could conflict. Just
> because the date and time aren't displayed in each control doesn't mean
> they aren't there.
>
> Any tips appreciated.. thanks.
>
> Ryan
>



 
Reply With Quote
 
Kevin Yu [MSFT]
Guest
Posts: n/a
 
      18th Oct 2006
Hi Ryan,

1. As you can see, to display the time in the DateTimePicker, we can
specify a CustomFormat and set Format to Custom to achieve this. Here I
used yyyy-MM-dd hh:mm:ss as the CustomFormat.

The Tab key is used to switch the focus between the controls. Since going
through each part of the Date/Time is within this control. The
DateTimePicker has defined the arrow keys to accomplish this. You can use
left/right key to move among the parts and use up/down key to adjust values.

2. If you are considering using 2 DateTimePickers to collection Date and
Time separately, you can use the first picker's date value and the second
picker's time value and combine them into a new datetime object. That will
do the same for you.

In my opinion, I suggest you try my first suggestion, because this can be
done with one control. If anything is unclear, please feel free to let me
know.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DateTime field Shri Microsoft Access Queries 3 19th Nov 2008 08:18 PM
DateTime Field in a Query??? Graham Feeley Microsoft Access 3 1st Jul 2006 10:51 PM
DateTime field Ryan Langton Microsoft Access ADP SQL Server 1 27th Jun 2005 10:12 PM
Q: exception on DateTime field =?Utf-8?B?SklNLkgu?= Microsoft ASP .NET 1 16th Mar 2005 08:23 PM
changing a datetime field to just a date field in an access table =?Utf-8?B?amFpbWVlMDAx?= Microsoft Access 1 20th Jan 2005 08:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:56 AM.