Show Sitemap ..Help2HTMLHelpWinHelp
Home ..

Creating Tooltips for Visual Basic .NET controls

Windows Forms supports ToolTip Help, which can be used to provide individual help for some or all controls on Windows Forms. The ToolTip component can be used to display a short specialized message.

To provide ToolTip Help in your application, you have to use the ToolTip control which you can find in the Toolbox on the Windows Forms tab. Drag and Drop a ToolTip component from the Toolbox to your form. It is a component rather than a control, so when you put it on your form it will sit in the component tray below. Rename this component to "tipExample1". This component gives every control on the form a new property called ToolTip on tipExample1.

The Windows Forms ToolTip component has several properties that you can set. The ToolTip component can be configured so that there is a delay before it is shown.

You must enter the text to be shown itself into ToolTip property of specific control or by coding directly. The ToolTip text will not be displayed for controls that are disabled.

Visual Basic Code

Me.tipExample1.SetToolTip(Me.lblInput, "This is a label for the input field")
Me.tipExample1.SetToolTip(Me.txtInput, "Please enter your first name")
Me.tipExample1.SetToolTip(Me.btnExecute, "Clicking this button generates a message for you")

    or to create a new line in the tooltip:

Me.tipExample1.SetToolTip( Me.Button1, "Foo" & ControlChars.NewLine & "Bar")


Download Example

Unfortunately, you don't have Visual Studio .NET but you have installed the Microsoft .NET Framework 1.0 (e.g. from your CD-Version of Windows XP SP1) unzip the example for Visual Basic 2002 and double-click the file VBnetCHM.exe.


Top ...