Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleWork with scrollbars in VB .NET
KeywordsScrollBar, VB.NET, LargeChange
CategoriesControls
 
There's something strange about VB .NET's scrollbars. If you set the Minimum, Maximum, and LargeChange properties as you did in VB 6, things don't work. One example I found in the VB .NET online documentation says to add LargeChange to the maximum value to allow the user to select the maximum value. Yes, this is stupid and means the property name Maximum makes little sense. Whatever...

In this example, vertical and horizontal scroll bars are set with Minimum = 1, Maximum = 7, and LargeChange = 2. The intent was to allow the user to select values between 1 and 5. When you run the program, you can click and drag to select values between 1 and 5 as desired. When you release the mouse, however, the scroll bar jumps to 6. If you click the ScrollBars' arrows or thumb areas (between the slider and the arrows), you can also select values between 1 and 6.

Something is definitely amiss here. If you figure out what, let me know.

 
Private Sub HScrollBar1_Scroll(...) Handles _
    HScrollBar1.Scroll
    lblHbar.Text = HScrollBar1.Value
End Sub

Private Sub VScrollBar1_Scroll(...) Handles _
    VScrollBar1.Scroll
    lblVbar.Text = VScrollBar1.Value
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated