VB Migration Partner

KNOWLEDGE BASE - Forms and controls


Previous | Index | Next 

[PRB] VB.NET controls are taller than the original VB6 control

You might notice that some VB.NET controls – most notably TextBox and ComboBox controls, and their variants – are taller than they were in the original VB6 application.

The reason is, by default VB.NET controls accommodate for their font’s height, therefore a large font may force the control to be taller than the value assigned to its Height property. The easiest solution is therefore to reduce the default size of the font used for these controls. Basically, there are two simple ways to achieve such a result.

First, you can use a project-level or form-level ReplaceFontSize pragma to decrease the size of a specific font, as in this example:

     '## project:ReplaceFontSize Arial, 10, Arial, 9

Second, you can use a PostProcess pragma to decrease the size of all the fonts used in the code-behind portions your forms, regardless of the font name or the original font size. For example, the following pragma subtracts 1 point to the original height of all the Font objects assigned to the Font property

     '## PostProcess "(?<=\.Font = New System\.Drawing\.Font\(.+?,\s+[0-9.]+)!", "- 1"

Notice that both these techniques modify the font size of all the controls on your forms, not just TextBox and ComboBox controls. In general, this is desirable because the result is a more consistent user interface.

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