NumUpdDown buttons

Discussion in 'Questions (Windows Mobile)' started by skipper, Jan 22, 2009.

  1. skipper

    skipper Member Licensed User

    Hello all

    is there any way to distinguish between Up and Down buttons in a NumUpDown control? I would like to intercept the DOWN button at value=0 to set value=Maximum and count backward (or UP button at Value=Maximum to set Value=0 and count forward.

    In case eg. Maximum is 10 and the value to be set is 8, it would be faster to count backward 0,10,9,8 than count forward 0,1,2,3,4,5,6,7,8....


    Many thanks

    Mimmo
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Try this code:
    Code:
    Sub Globals
        ignoreEvent = 
    False
    End Sub

    Sub App_Start
        Form1.Show
        Num1.Minimum = -
    1
        num1.Maximum = 
    11
    End Sub

    Sub Num1_ValueChanged
        
    If ignoreEvent Then Return
        
    If num1.Value = num1.Minimum Then
            ignoreEvent = 
    True
            num1.Value = num1.Maximum-
    1
        
    Else If num1.Value = num1.Maximum
            ignoreEvent = 
    True
            num1.Value = num1.Minimum+
    1
        
    End If
        ignoreEvent = 
    False
    End Sub
     
Loading...
  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