Auto format textbox to time
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Auto format textbox to time

  1. #1
    Join Date
    Feb 2014
    Posts
    2

    Auto format textbox to time

    We have some hourly employees who need to fill in time sheets and they sometimes have problems with the math so I'm developing an application to help with that, their pay period is every two weeks. So what I have here is a basic time in and time out sheet where they can enter the times for their shift. I was wanting it to auto format so that if they enter 330 (like below) it will show as 3:30, also if they enter a leading 0 on a time such as 0220, (like below) I would like it to show as 2:20. Can anyone help with that? I'm using visual studio 2012 asp.net.


    Name:  TimeClock.png
Views: 147
Size:  16.5 KB

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,985

    Re: Auto format textbox to time

    Use the phone format. Drop-down HOURS and then 4 MINUTE choices for each. Or, even better, just SHIFT, OT, and then OT HOURS/MIN
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Feb 2014
    Posts
    2

    Re: Auto format textbox to time

    I was thinking about using drop down boxes for the hours, that would eliminate the am/pm drop down, but I was able to come up with code that could figure out the time difference without specifying am/pm or using a 24 hour clock. Anyway, I would like the user interface to be as friendly and clutter free as possible and having separate drop down boxes for time and minutes will double the amount of textboxes.

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,985

    Re: Auto format textbox to time

    I think idiot-proof would be better. In the long run, anyways. Military time isn't that hard. And PC's compute date/time
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center