|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DateTime Fieldbe 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 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. Show quoteHide quote "Ryan" <Tyveil@newsgroups.nospam> wrote in message news:Ol4%23OMg8GHA.3552@TK2MSFTNGP03.phx.gbl... > 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 > 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/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx. ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.)
how do you use Class to hold global variables?
Installed, but where is it? Full qual. name of current method Writing Data In Tabular format in Text File. What framework is running in this scenario? VBNET2005 : Manipulating MS Access tabledefinitions in VB.NET -> Create, Copy and Drop Table. Showing Form in New Thread? db connections and text boxes Passing parameters in VB 2005!! User controls in VS 2005 |
|||||||||||||||||||||||