none
HELP!!Access DB shorttime format field input & output PROBLEM in a MasketTextBox RRS feed

  • Question

  • Hello everyone,

    What I want to do is quite simple:I have an access db,one field is datetime type and in shorttime format(09:30).I want to frequently input this data in a data entry form and save back to access,of course need query by SQL sometime.I knew there is a DatetimePicker which can show exactly what I wantTongue Tiedhorttime format,sorry but I (my client) do not want to use it for I found that I need to hit left arrow key to jump between the hour part and the minute part.I don't need left arrow key when I am inputing.say ,when I input  21 (hour part),the arrow should automatically jump to the minute part awaiting input.

    I want to try in a MasketTextBox.It has a mask property.I set the value "90:00",but when I run the program,the masketTextBox shows my shorttime field value (21:30) as  18:99    .What a surprise!!

    I was almost driven crazy since I need this problem done before the deadline.It seems a very little question but it is so hard to solve?

    Grateful for your help me to make it done asap.

    Regards,
    Sam.
    Friday, July 13, 2007 4:05 AM

All replies

  •  

    You can use the keypress event, in the event code see what position the cursor is in and the format the text and move the cursor as needed..

     

    With the Keypress event you can use c.KeyChar to ensure only numbers are pressed. After the second number is depressed you can automatically add the   :   character and move the cursor on position.

     

     

    Friday, July 13, 2007 4:38 AM
  • Do you mean still using DateTimePicker,then what's the possible code look like,Could you please paste a sample here?Thanks.

    By the way,could you please let me know what's going on there for the wrong output of 18:99 in a MasketTextBox,and how to fix it.

    Thanks very much.

    Sam


    Friday, July 13, 2007 6:02 AM