VB Migration Partner

KNOWLEDGE BASE - Forms and controls


Previous | Index | Next 

[PRB] ScrollBar controls ignore the LargeChange property

VB6 and .NET scrollbar controls differ for an important detail: if the .NET scrollbar’s LargeChange property is set to a value higher than 1, then the scrollbar’s Value property can’t reach the current Max value if the scrollbar indicator is moved to its “max” position. More precisely, this property can’t go higher than Max-LargeChange+1, therefore the problem manifests itself if (Max-Min) isn’t a multiple of LargeChange.

For this reason, by default all the scrollbar controls in the CodeArchitects.VBLibrary – namely, VB6HScrollBar, VB6VScrollBar, VB6WLHScroll, VB6WLVScroll, and VB6FlatScrollBar – ignore any assignment to the LargeChange property. More precisely, the property correctly retains the value assigned to it, but the new value isn’t assigned to the underlying .NET control. This behavior ensures that the application works as intended, even though the user will perceive a difference in how the scrollbar responds to mouse actions.

You can restore the standard .NET behavior by assigning False to the IgnoreLargeChange property that all these VB6*** scrollbar controls expose. You can perform this assignment in code or you can have this property set at design-time, by adding an appropriate WriteProperty pragma in the original VB6 application:

        ' enforce .NET behavior for Scroll1
        '##Scroll1.WriteProperty IgnoreLargeChange, False

Often this fix isn’t enough to ensure that a VB.NET scrollbar works exactly like the VB6 counterpart, and you also need to change the Max property in the Form_Load event handler, as follows:

        Private Sub Form1_Load() Handles Me.Load
            Scroll1.IgnoreLargeChange = False
            Scroll1.Max = Scroll1.Max + Scroll1.LargeChange - 1
        End Sub

For more information about LargeChange and SmallChange properties, read this KB article.

Previous | Index | Next 




Follow Francesco Balena on VB6 migration’s group on

LinkedIn





Read Microsoft Corp’s official case study of a VB6 conversion using VB Migration Partner.




Code Architects and its partners offers remote and onsite migration services.

More details




Subscribe to our free newsletter for useful VB6 migration tips and techniques.

newsletter



To learn more about your VB6 applications, run VB6 Analyzer on your source code and send us the generated text file. You will receive a detailed report about your VB6 applications and how VB Migration Partner can help you to quickly and effectively migrate it to .NET.

Get free advice



A fully-working, time-limited Trial Edition of VB Migration Partner allows you to test it against your actual code

Get the Trial




The price of VB Migration Partner depends on the size of the VB6 application, the type of license, and other factors

Request a quote




Migrating a VB6 application in 10 easy steps

Comparing VB Migration Partner with Upgrade Wizard

Migration tools: Feature Comparison Table

All whitepapers