VB Migration Partner

KNOWLEDGE BASE - Forms and controls


Previous | Index | Next 

[HOWTO] Speed up execution by removing unnecessary Refresh methods

Assigning a property of a VB6 control via code typically doesn’t update the control, until the application enters the “idle” state and all UI items are updated automatically. VB6 developers are aware of this behavior and use to add calls to the control’s Refresh method to force the update when the property is assigned inside a loop. This technique is often necessary, for example, to display a running percentage in a Label control.

Conversely, most .NET controls – and therefore, most controls in the CodeArchitects.VBLibrary – are updated automatically as soon as one of their properties is assigned a different value. For this reason, calls to the Refresh methods are unnecessary and can be safely removed after the migration. You can remark out calls to Refresh method by means of a ParseMode pragma:

        Dim i As Integer
        For i = 0 To 10000
            Label1.Caption = i & "%"
            '##ParseMode Remarks, 1
            Label1.Refresh
            ' ...
        Next

In addition to refreshes caused by unnecessary Refresh methods, keep in mind that VB.NET controls can receive a WM_PAINT even if you change a visual property of their container, for example the Caption property of the parent form.

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