Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: VB7
Expertise: beginner
Dec 23, 2002



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Creating multiline tooltips

In VB6 there was no easy way to create multiline tooltips for form controls, you necessarily had to resort to API tricks. And it was probably just not worth the effort. The good news is that doing this is straightforward in VB.NET! First add a Tooltip Provider control on the form to add the Tooltip On TooltipProviderCtl property to all the controls on the form, and set your tooltip as a single line long text. Finally, go to the code view, within the InitializeComponent method locate the line that set the tooltip, and split the tooltip text with new-line characters, as you would do with any other string. Here's an example:

Me.ToolTipProviderCtl.SetToolTip(Me.Button1, "this is" & environment.NewLine & _
    "a multiline" & environment.NewLine & "tooltip!")
Instead of modifying the code directly in InitializeComponent, you can programmatically set multiline tooltips for your controls in a separate method, called from Form_Load.
Marco Bellinaso
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date