VB Migration Partner

KNOWLEDGE BASE - Forms and controls


Previous | Index | Next 

[INFO] TabStrip and SSTab controls don’t display hotkeys in button captions

VB6’s TabStrip controls can react to hotkeys defined by assigning a string containing an ampersand (&) character to the Caption property of individual Tab objects. Similarly, you can define hotkeys for individual pages of an SSTab control by assigning a string containing an ampersand to the TabCaption property.

The TabStrip and the SSTab controls are converted to VB6TabStrip and VB6SSTab controls, respectively, both of which inherit from .NET TabControl. This control doesn’t offer the ability to process ampersands in individual tab captions; for this reason, individual ampersand characters are stripped off tab captions during the migration process. The end user isn’t allowed to switch to a different tab by means of Alt+key combination and can only cycle among tabs using the Ctrl+Tab key combination or the mouse.

There is no workaround for this issue. It is recommended that you drop all ampersands in SSTab and TabStrip captions before the migration, to have a consistent behavior both in VB6 and VB.NET.

On a related topic, notice that ampersand characters are stripped off both during the migration process and when you assign a tab caption via code, as in this code:

     SSTab1.TabCaption(1) = "&Options"

This behavior has a subtle consequence: if you later read back the TabCaption property, you’ll find the ampersand under VB6 but not in the converted VB.NET program:

        SSTab1.TabCaption(1) = "&Options"
        ' ...
        If SSTab1.TabCaption(1) = "&Options" Then
            ' this block is executed in VB6
        Else
            ' this block is executed under VB.NET, 
            ' because TabCaption(1) returns "Options"
        End If

You can work around this minor issue by slightly modifying the test, for example:

        If InStr(SSTab1.TabCaption(1), "Options") > 0 Then
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