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. C#
  4. numericUpDown Control - double digits?

numericUpDown Control - double digits?

Scheduled Pinned Locked Moved C#
cssquestion
6 Posts 3 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.
  • K Offline
    K Offline
    KingTermite
    wrote on last edited by
    #1

    I am using a numericUpDown control which represents a minutes (for time) value. I want it to display 00, 01, 02, etc... for numbers less than 10. Is there a simple way to do this with a property (I reviewed the documentation, but didn't see anything immediately)? I know I could do it if I inherit the control, but I was hoping for a simple property or somethign to accomplish it. Something that I missed in the documentation. Can it be done without inheriting it?


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    A H 2 Replies Last reply
    0
    • K KingTermite

      I am using a numericUpDown control which represents a minutes (for time) value. I want it to display 00, 01, 02, etc... for numbers less than 10. Is there a simple way to do this with a property (I reviewed the documentation, but didn't see anything immediately)? I know I could do it if I inherit the control, but I was hoping for a simple property or somethign to accomplish it. Something that I missed in the documentation. Can it be done without inheriting it?


      There are only 10 types of people in this world....those that understand binary, and those that do not.

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      The property you are looking for is not available.

      1 Reply Last reply
      0
      • K KingTermite

        I am using a numericUpDown control which represents a minutes (for time) value. I want it to display 00, 01, 02, etc... for numbers less than 10. Is there a simple way to do this with a property (I reviewed the documentation, but didn't see anything immediately)? I know I could do it if I inherit the control, but I was hoping for a simple property or somethign to accomplish it. Something that I missed in the documentation. Can it be done without inheriting it?


        There are only 10 types of people in this world....those that understand binary, and those that do not.

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        No property like this is available, but if you extend NumericUpDown you can simply override UpdateEditText. If Hexidecimal is set, be sure to call the base.UpdateEditText unless you want to handle this yourself. Also, when formatting the number, don't forget to take the ThousandsSeparate into account.

        Microsoft MVP, Visual C# My Articles

        K 1 Reply Last reply
        0
        • H Heath Stewart

          No property like this is available, but if you extend NumericUpDown you can simply override UpdateEditText. If Hexidecimal is set, be sure to call the base.UpdateEditText unless you want to handle this yourself. Also, when formatting the number, don't forget to take the ThousandsSeparate into account.

          Microsoft MVP, Visual C# My Articles

          K Offline
          K Offline
          KingTermite
          wrote on last edited by
          #4

          Thank Heath...that's kind of what I thought. I figured I'd have to inherit/extend it to make it work. I just wanted to make sure there wasn't a property for it that I missed before I went through all the trouble.


          There are only 10 types of people in this world....those that understand binary, and those that do not.

          H 1 Reply Last reply
          0
          • K KingTermite

            Thank Heath...that's kind of what I thought. I figured I'd have to inherit/extend it to make it work. I just wanted to make sure there wasn't a property for it that I missed before I went through all the trouble.


            There are only 10 types of people in this world....those that understand binary, and those that do not.

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            I take it that you looked at the class documentation for the NumericUpDown class, right? Deriving from your sig, "there are 10 types of people in this world...those that read the documentation and those that do not." :) (Unfortunately, most of the posters here fall in the latter category.) Typically, you can learn everything you need to know from the docs (add that to experience and reading articles on MSDN, CodeProject, et. al.). If some member overrides a base member of defined new and you find the documentation a little lacking on details, use ildasm.exe - the IL disassembler that comes with the .NET Framework SDK - to view the IL for the implementation in that assembly, or use a good decompiler like .NET Reflector[^] (though its decompiler rarely incorrect / incomplete). You can learn a heck of a lot that way - perhaps even pick up a few pointers from the developers at Microsoft who wrote the base class libraries.

            Microsoft MVP, Visual C# My Articles

            K 1 Reply Last reply
            0
            • H Heath Stewart

              I take it that you looked at the class documentation for the NumericUpDown class, right? Deriving from your sig, "there are 10 types of people in this world...those that read the documentation and those that do not." :) (Unfortunately, most of the posters here fall in the latter category.) Typically, you can learn everything you need to know from the docs (add that to experience and reading articles on MSDN, CodeProject, et. al.). If some member overrides a base member of defined new and you find the documentation a little lacking on details, use ildasm.exe - the IL disassembler that comes with the .NET Framework SDK - to view the IL for the implementation in that assembly, or use a good decompiler like .NET Reflector[^] (though its decompiler rarely incorrect / incomplete). You can learn a heck of a lot that way - perhaps even pick up a few pointers from the developers at Microsoft who wrote the base class libraries.

              Microsoft MVP, Visual C# My Articles

              K Offline
              K Offline
              KingTermite
              wrote on last edited by
              #6

              Yes, I did read the documentation, the problem is that Microsoft documentation isn't always as solid as it could be. Once you've "done it", then you see in retrospect how to "do it", but that doesn't mean the documentation just explains every nuance. Far from it usually. That was why I said up front that I knew it was possible if I inherited the class, but wanted to make sure there wasn't a proprety or something like that I was missing. I'll keep that in mind about the ildasm.exe....I remember you showing me that on the COM DLL problem I had last week.


              There are only 10 types of people in this world....those that understand binary, and those that do not.

              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