NumUpDown control

Discussion in 'Questions (Windows Mobile)' started by davelew1s, Jul 28, 2007.

  1. davelew1s

    davelew1s Active Member Licensed User

    Can the NumUpDown control be used to increment and display numbers with a decimal point? I've had a play but nothing is obvious ...any ideas?
    Dave Lewis.
  2. Cableguy

    Cableguy Expert Licensed User

    Staright answer....NO

    BUT you can use a combination of num control to create a decimal number...
    like one to the hole number, one to 1/10ths and one th the 1/100... then combine the results

    a=num1.value &","& num2.value & num3.value
    suposing that the min is set to 0 and max to 9

    If num1 = 5 and num2=4 and num3 = 2
  3. Stellaferox

    Stellaferox Active Member Licensed User

    See also the code in this example, not yet finished under the control UNITS.

    Attached Files:

  4. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Here's a simple solution, I offered to someone in the old forum who wanted to increment in Tens...

    Just overlay a TextBox over the NumUpDown control, now you can display in whatever units you want, you could even add a symbol if needed.

    Attached is an example that counts in 0.1 increments, bet you can't spot any difference in operation to a normal NumUpDown control :cool:


    Attached Files:

  5. agraham

    agraham Expert Licensed User

    Well the text is grey and doesn't match other controls' text because the Textbox needs to be disabled and this automatically greys the text.:(

    To REALLY make it look like a normal UpDown control leave the Textbox enabled and use a GotFocus event procedure to prevent user entry.:cool:
    Sub TextBox1_GotFocus
    End Sub
    EDIT: Erel, if you read this, why do I get two GotFocus events in this situation? Without the Num1.Focus I get the single event I expect, if I call the .Focus method on any other control I get called twice!
    Last edited: Jul 29, 2007
  6. davelew1s

    davelew1s Active Member Licensed User

    Thanks for the replies, Randomcoder your solution works find for me the fact that it's greyed out is a bonus.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice