JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Setting Scroll Bars' Minimum and Maximum Values

The Testing Department is calling again. The Field Testing Unit loves the new program you've written to help them record in-the-field performance of the company's products, but there's just one problem: performance is measured on a scale of 1–10, and the scroll bars in your program seem to go from 0–100. It's been very hard for the users of your program to operate with only one-tenth of the whole scroll bar—can you rescale it?

Yes, you can. After you place a scroll bar in a program, the first thing to do is to set its range of possible values, which by default is 0–100. The minimum value a scroll bar can be set to is stored in its Minimum property, and the maximum value in the Maximum property. You can set the Minimum and Maximum properties for scroll bars at design time or at run time; here's how we change those properties in a horizontal scroll bar when a form loads:

Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    HScrollBar1.Minimum = 0
    HScrollBar1.Maximum = 10
End Sub
Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor