Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. Time pick control

Time pick control

Scheduled Pinned Locked Moved Windows Forms
winformsquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    progDes
    wrote on last edited by
    #1

    Hi all. I'm new in Windows Forms. Is there is some control to enter time data. Like a NumericUpDown, but for time in format MM:SS.mmmm. And where I can find such control (if it exists), what assembly? Dot want to waste time implementing the new one. Thanks.

    S 1 Reply Last reply
    0
    • P progDes

      Hi all. I'm new in Windows Forms. Is there is some control to enter time data. Like a NumericUpDown, but for time in format MM:SS.mmmm. And where I can find such control (if it exists), what assembly? Dot want to waste time implementing the new one. Thanks.

      S Offline
      S Offline
      Simon P Stevens
      wrote on last edited by
      #2

      There's a DateTimePicker[^] control. Set the format property to Time. Or you can use a use a MaskedTextBox[^] control. There is a sample time format mask provided or you can define your own.

      Simon

      P 1 Reply Last reply
      0
      • S Simon P Stevens

        There's a DateTimePicker[^] control. Set the format property to Time. Or you can use a use a MaskedTextBox[^] control. There is a sample time format mask provided or you can define your own.

        Simon

        P Offline
        P Offline
        progDes
        wrote on last edited by
        #3

        Well, thanks for reply. I can use them. But custm format doesnt support displaying milliseconds. So, I have to use what Windows Forms have...

        S 1 Reply Last reply
        0
        • P progDes

          Well, thanks for reply. I can use them. But custm format doesnt support displaying milliseconds. So, I have to use what Windows Forms have...

          S Offline
          S Offline
          Simon P Stevens
          wrote on last edited by
          #4

          If you use the masked text box you should be able to define whatever format you want. Try setting the mask to something like "00:00:00.0000" You'll probably have to manually validate things like the seconds don't go above 59 etc. Is that what you are looking for?

          progDes wrote:

          So, I have to use what Windows Forms have...

          You could write a custom control if you really wanted, but from the sounds of it, I think the masked text box will probably do the job. You could write a custom control and inherit from the masked text box and just add the extra time validation logic. That would be quite a good way of doing things.

          Simon

          P 1 Reply Last reply
          0
          • S Simon P Stevens

            If you use the masked text box you should be able to define whatever format you want. Try setting the mask to something like "00:00:00.0000" You'll probably have to manually validate things like the seconds don't go above 59 etc. Is that what you are looking for?

            progDes wrote:

            So, I have to use what Windows Forms have...

            You could write a custom control if you really wanted, but from the sounds of it, I think the masked text box will probably do the job. You could write a custom control and inherit from the masked text box and just add the extra time validation logic. That would be quite a good way of doing things.

            Simon

            P Offline
            P Offline
            progDes
            wrote on last edited by
            #5

            Ok thanks.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups