Resources

VB6 vs VB.NET controls - HScrollBar and VScrollBar controls


This section describes the differences between VB6 and .NET controls and the problems you can find in migrating VB6 applications with user-interface. The differences that are common to most controls are described in the Controls (general) section.

For a list of differences between VB6 and VB.NET language, see here.

Unless otherwise stated, VB Migration Partner fully supports all the Visual Basic 6 features mentioned in this page. It is worth noticing that names of properties and methods are preserved, which ensures that those even late-bound references work correctly after the migration to VB.NET. For more information, please read the manual and the knowledge base section.





HScrollBar and VScrollBar controls

Change event

The Change event isn’t supported and has been replaced by the ValueChanged event.



LargeChange property

.NET scrollbars deal with this property in a very special way: if the value of this property is higher than 1 and isn’t a divisor of the Maximum value, then the end user can’t click below or above the thumb indicator to scroll the bar to a value higher than Max-LargeChange+1. For example, if Maximum=255 and LargeChange=10 then the scrollbar can’t be scrolled to a value other than 250. No range limit is enforced if clicking on the scrollbar arrows, though.

This limitation is inherent to the .NET Framework and VB Migration Partner can only attempt to make the problem less serious. The easiest way to ensure that the converted VB.NET application works well is forcing the LargeChange property to be equal to 1 and ignoring all assignments to it. The neat result is that the end user can move the thumb indicator up to its maximum position, even if the scrollbar will react more slowly.

This feature can be controlled by means of the IgnoreLargeChange property, whose default value is True. If you set this value to False, values assigned to the LargeChange property become immediately effective and the scrollbar will behave similarly to the original VB6 program.



Min and Max properties

The Min and Max properties aren’t supported and map to Minimum and Maximum properties, respectively.

Even more important is that VB6 supports scrollbars whose minimum value is higher than its maximum value, a setting that is useful to implement scrollbars that work in nonstandard way (for example, a vertical scrollbar whose bottommost position corresponds to the minimum value). This arrangement isn’t available for .NET scrollbars, as this code demonstrates:

        HScroll1.Minimum = 1
        HScroll1.Maximum = 100
        HScroll1.Minimum = 200             ' higher than Maximum!
        Debug.WriteLine(HScroll1.Maximum)  ' displays "200"

Converting such scrollbars to VB.NET using the Upgrade Wizard can be quite cumbersome. VB Migration Partner fully supports the Min and Max properties and, above all, supports the VB6 behavior and guarantees that functional equivalence is preserved.



Scroll event

The Scroll event is supported, with a caveat: in VB6 the Value property has been already updated when the event fires, whereas in VB.NET the Value property contains the previous value when the event fires. You can learn the updated Value property by querying the NewValue property of the ScrollEventArg object passed as an argument to the event handler.

VB Migration Partner fully supports this event and automatically accounts for this minor difference: when the Scroll event fires, the Value property has been already updated with the new value.







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