Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrollbar does not work like VB6?!?!

Status
Not open for further replies.

RMS001

Programmer
Nov 12, 2002
45
CA
---------------------------------------------------------
VB6

VScroll1 (properties):

Max = 100
Min = 0 (default)
Height = 2160 (twips - allows one pixel movement per value change)
LargeChange = 10 (default)
SmallChange = 1 (default)
Value = 0 (default)

Form1 (code):

Private Sub VScroll1_Change()
Label1 = VScroll1.Value
End Sub

Private Sub VScroll1_Scroll()
Label1 = VScroll1.Value
End Sub

This code produces a working scroll bar with the minimum
value of zero (0) and a maximum value of 100 displayed in
Label1.Caption when scrolled or arrow-clicked
---------------------------------------------------------

---------------------------------------------------------
VB7

VScrollBar1 (properties):

Max = 100 (default)
Min = 0 (default)
Height = 144 (allows one pixel movement per value change)
LargeChange = 10 (default)
SmallChange = 1 (default)
Value = 0 (default)

Form1 (code):

Public Class Form1
Inherits System.Windows.Forms.Form

Windows Form Designer generated code


Private Sub VScrollBar1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles VScrollBar1.ValueChanged
Label1.Text = VScrollBar1.Value
End Sub
End Class

This code produces a non-working scroll bar with the minimum
value of zero (0) and a maximum value of 91 displayed in
Label1.Text when scrolled or arrow-clicked.

I have determined that the 91 value comes from subtracting the
LargeChange value (10) from the Max value (100) and adding the
SmallChange value (1)? Is Microsoft this sloppy in designing
DotNet?

If you change the LargeChange value to one (1), the VScrollBar
control functions properly. (At least value-wise).

NOTES:
The VScrollBar1_Scroll event works dismally as it will not reach
the min and max without going verrrry verrrry swowly, and even
then only after you let the mouse button up.

Please tell me this is just my initiation ritual to VB7.0 and this
control is not as usless as it seems to be.

I just took the $2,000 Microsoft Official Curriculum course on VB.NET
and even the instructor couldn't answer this one.

PS - Run the VB6 project through the upgrade wizard and all is well.
(Although, it seems the TextAlign property does not work (allow Center,
LeftJusify, and RightJustify like in 6.0) if Label1.AutoSize is set to True.
Oh well... I love Micwosoft.
 
Wellllll...

It seems (after considerable research) this is the way a scrollbar is supposed to work under VB.NET
It would have been nice if a little DOTNET 'original intrinsic control changes' notice could have been issued by MIcrosoft.
No - thats too much to ask! (Sorry, what was I thinking)
Anyway, DOTNET scrollbars do not work like VB6 scrollbars.
They do not reach the maximum value by design.

Never mind...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top