Click here to Skip to main content
16,017,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I'm a freshie to VB.NET. I know that DateTimePicker(DTP) can be edited on keypress(UP/DOWN Key). This is perfect.

Now im using DTP with custom format(hh:mm tt - 12:00AM). I would like to make the DTP editable through keypress(character keypress). I'm able to set focus on hh or mm or tt separately and use the UP/DOWN key to edit but it is not working if I press on any numeric keys(0-9). I guess there is no implementation for this.

I tried to implement one myself but I got stucked in.

1) how to know where is my current focus, whether its hh mm tt?
2) and if i'm able to know the focus, how to update the new value to the DTP object?

Are there any experts on this would like to give a hand or suggest me any other sites where I can get more information about this?

Thanks in advance,
Skunkhead.
Posted
Comments
DaveAuld 2-Jan-11 17:21pm    
I have entered the custom format you have listed above, and have found the up/down and 0-9, a/p all work fine. Although not sure what the custome format output should look like as i get something like "10:20 PM - 12:00A 1"
skunkhead 3-Jan-11 20:59pm    
Hi DaveAuld, i'm really looking forward to know how you were able to use the '0-9' keys in DateTimePicker. D0 you able to change the time values using the '0-9' keys? Can you share with me your knowledge on this?

First Set DTP Format to custom.
Then set custom format hh:mm:tt

or


By Default DTP not provide the facility to change with Key Up/Down.
for Performing this operation you should need to create a Custom Control in which have three numericupdown button which shows the value of hh mm and tt.

The Custom control will be visible if user press f2. and Set the location of Custom control to DTP Location.
 
Share this answer
 
this[^] may guide you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900