Udostępnij za pośrednictwem


Help Support for Visual Basic 6.0 Users

This topic compares support for implementing help in Visual Basic 6.0 with its equivalent in Visual Basic 2008.

Most applications provide help for users in the form of a Help file, pop-up Help, and / or ToolTips. While both Visual Basic 6.0 and Visual Basic 2008 support all three Help mechanisms, the methods of implementing them differ considerably.

Conceptual Differences

In Visual Basic 6.0, Help could be provided using either HTML Help or the older Windows Help format. In Visual Basic 2008, only HTML Help is supported.

Help support in Visual Basic 6.0 was implemented on a per-project basis by specifying a Help file name in the Project Properties dialog box. Each form and control had a HelpContextID property that could be used to link to a specific topic in the Help file.

Help support in Visual Basic 2008 is implemented on a per-form basis by adding one or more HelpProvider components to a form. Each form and control has HelpKeyword and HelpNavigator properties that were used to link to a specific topic. For more information, see How to: Provide Help in a Windows Application.

Pop-up Help

Pop-up Help in Visual Basic 6.0 was implemented using the WhatsThisButton and WhatsThisHelp properties of a form. The What's This button appeared if WhatsThisButton was True and both the MaxButton and MinButton properties were False. Setting the WhatsThisMode property in code enabled the button.

Pop-up Help in Visual Basic 2008 is implemented using the HelpButton property of a form. The Help button only appears if the HelpButton property is set to True and both the MaximizeBox and MinimizeBox properties are set to False; the button is automatically enabled. For more information, see How to: Display Pop-up Help.

ToolTips

ToolTips in Visual Basic 6.0 were implemented using the ToolTipText property of a control.

ToolTips in Visual Basic 2008 are implemented by adding a ToolTip component to a form. For more information, see ToolTip Support for Visual Basic 6.0 Users.

ShowHelp Method

In Visual Basic 6.0, Help could also be displayed using a ShowHelp method of a CommonDialog control to open Windows Help. Windows Help is no longer supported in Visual Basic 2008 and there is no equivalent control for displaying Help.

Code Changes for Help Support

The following code illustrates the differences in coding techniques between Visual Basic 6.0 and Visual Basic 2008 for some common uses of Help properties.

Specifying a Help file

The following example demonstrates how to specify a Help file for your application, assuming that your form has two OptionButton controls that allow the user to choose between English and French Help files.

' Visual Basic 6.0

If Option1(0).Value = True Then

App.HelpFile = App.Path & "\EnglishHelp.chm"

Else

App.HelpFile = App.Path & "\FrenchHelp.chm"

End If

' Visual Basic' Assumes a HelpProvider component has been added to the form.If RadioButton1.Checked = TrueThen
    HelpProvider1.HelpNamespace = My.Application.Info.DirectoryPath & _
        "\EnglishHelp.chm"Else
    HelpProvider1.HelpNamespace = My.Application.Info.DirectoryPath & _
        "\FrenchHelp.chm"EndIf

Displaying a ToolTip

The following demonstrates code to display a ToolTip.

' Visual Basic 6.0

Private Sub Text1_Change()

Text1.ToolTipText = "The text has changed"

End Sub

' Visual Basic' Assumes a ToolTip component has been added to the form.PrivateSub TextBox1_TextChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles TextBox1.TextChanged
    ToolTip1.SetToolTip(TextBox1, "The text has changed")
EndSub

Help Support Equivalencies

Visual Basic 6.0

Visual Basic 2008

App.HelpFile property

HelpProvider component

HelpContextID property

SetHelpKeyword method. For more information, see How to: Provide Help in a Windows Application.

ToolTipText property

SetToolTip method. For more information, see ToolTip Support for Visual Basic 6.0 Users.

WhatsThisButton property

HelpButton property

WhatsThisHelp property

HelpButton property

WhatsThisHelpID property

HelpString property

WhatsThisMode property

No equivalent. Enabled by default.

Upgrade Notes

When a Visual Basic 6.0 project is upgraded using the upgrade wizard in Visual Basic 2008, any Help-related properties or code will not be upgraded. You need to reimplement Help support for your application after upgrading. If your Help file was written using HTML Help, you can reuse the Help file; if it was written using Windows Help it will need to be rewritten.

See Also

Tasks

How to: Provide Help in a Windows Application

How to: Display Pop-up Help

Concepts

ToolTip Support for Visual Basic 6.0 Users

Other Resources

Integrating User Help in Windows Forms