locked
Time format ? RRS feed

  • Question

  • Hi All

     

    I would like to have a text box just for time, is there a component just for setting time?

     

    thanks

     

    Gibbo

    Thursday, June 7, 2007 7:27 PM

Answers

  • A MaskedTextBox can fit your needs? You can then "Edit Mask" and choose what kind of text you can write in...
    Friday, June 8, 2007 9:38 AM
  • Have you had a look at the DateTimePicker in the Toolbox?
    Friday, June 8, 2007 12:09 PM

All replies

  • You need to use a Timer control. Enter this line in the timer's Tick event:

     

             txtTime.Text = Now.ToLongTimeString

     

    Set the timer's Enabled property to True.  Set the Interval property to 250 to refresh every 1/4 second.

     

    It will keep updating the time every second in your textbox.

     

    Thursday, June 7, 2007 8:53 PM
  • thankyou for your reply but im after something slightly different

     

    My user does not need to put in now,

     

    just a time HH:MM based on a 24hour clock, i can make a control to do this, just wondered if there was anything already in existence that made it easy to imput time format? (Like a calender control for Date)

     

    thanks

     

    gibbo

    Friday, June 8, 2007 9:22 AM
  • A MaskedTextBox can fit your needs? You can then "Edit Mask" and choose what kind of text you can write in...
    Friday, June 8, 2007 9:38 AM
  • Have you had a look at the DateTimePicker in the Toolbox?
    Friday, June 8, 2007 12:09 PM