PRB: UpDown Control May Not Increment As Expected

ID: Q189808


The information in this article applies to:
  • Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0


SYMPTOMS

When you click the up or down button on an UpDown control, you notice that the value changes by more than the amount specified for the Increment property. For example, if the Increment property is 2, the value of the UpDown control may change by 3 instead of 2.


CAUSE

When you click the up or down button to change the value of an UpDown control, the control will first "normalize" the current value before it is changed by the amount specified in the Increment property. By normalizing the value, the UpDown control may change by more than the amount specified in the Increment property so that the new value is evenly divisible by the Increment.


STATUS

This behavior is by design.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new Standard EXE project. Form1 is created by default.


  2. Choose Components from the Project menu, check "Microsoft Windows Common Controls-2" and click OK. The UpDown control should now be available on the Toolbox.


  3. Add a Textbox control to Form1.


  4. Add an UpDown control to Form1.


  5. Set the properties of the UpDown1 control as follows:
    
          BuddyControl = Text1
          BuddyProperty = Text
          Increment = 2
          Max = 13
          Min = 3
          Value = 3 


  6. Add the following code to the Form1 module:
    
          Option Explicit
    
          Private Sub Form_Load()
             Text1.Text = UpDown1.Min
          End Sub 


  7. Run the project. Form1 appears.


  8. Click once on the up arrow of the UpDown control. Although the Increment property is 2, the value of the UpDown control changes from 3 to 6 rather than 3 to 5.


Additional query words: kbDSupport kbDSD kbVBp kbVBp500 kbCtrl kbVBp600

Keywords : kbGrpVB
Version :
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: January 5, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.