devxlogo

Use the ScrollBar Instead of UpDown or Spin Controls

Use the ScrollBar Instead of UpDown or Spin Controls

If you want the user to be able to select from a fixed range of numeric values, you have a number of choices. In VB6, you can use the UpDown control, part of Common Controls 2 (630K), or the Spin control, part of the Forms 2.0 Object Library (more than 1 MB and not redistributable). Instead of either of these controls, you can use a standard vertical ScrollBar to provide the same functionality in any VB version from VB3 through VB6, without any additional baggage in your installation. Place a TextBox (Text1) and a vertical ScrollBar (VScroll1) on the form, with the ScrollBar touching the right edge of the TextBox. Make sure that the ScrollBar is the same height as the TextBox, and that the thumb is not visible. You do not want the user to be able to change the TextBox value by entering a new value directly, so you should set the TextBox Locked property to True. You need to make the ScrollBar work the same way the other controls do

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist