Adding Custom Tooltips – Visual Basic .NET 2002/2003


In Visual Basic 6.0 we had a property for tooltip balloons. All you needed to do was type in the text you wanted to display. But you didn’t really have much control over the toolTips in general. In Visual Basic.NET, that simple feature appears to have been removed by default. That doesn’t mean we still can’t have tooltips. Below you will see just how simple it is to implement this feature and control how your tooltips will react. You have more “say” in what goes on with your tooltips. For Example, you can now set the length of time the pointer must remain stationary within the tooptip region before the balloon will appear.

To get started, start a project. In your ToolBox look for a ToolTip component. If you do not see one, then right click inside your toolbox and select “Customize Toolbox”. Click the “.Net Frameworks Componets” tab, scroll down till you find “ToolTip” then check the box and press OK. You should now see a ToolTip component available. Double click the ToolTip to add it to your project. I re-named mine toolTip. If you look at the properties available for the ToolTip you will see: Automatic Delay, Initial Delay, and such that are available. I will not go over any of these settings since they are pretty much self-explanatory. Go ahead and add a button to the form. I named mine btn. In the btn_MouseHover event put:

toolTip.SetToolTip(btn, “Hello, This is just a simple test….”)

Start your project and place your mouse pointer within the button region and let it sit idle for a few seconds. You should then see the ToolTip balloon popup with the text you specified. You can also goto the ‘btn’ Button control property, you will see a property named: “Tooltip on tooltip”. You can put the text you want displayed and it will use your ToolTip settings without having to execute the toolTip yourself. As you can see, it is very easy to add support for ToolTips.

4 responses to “Adding Custom Tooltips – Visual Basic .NET 2002/2003

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s