How to Use Tooltips in VB
One of the standard features of Windows forms applications is the help text that appears when the user scrolls over a control such as a button or textbox. This short bit of help gives the user a clue about what they are supposed to do or what the control does. The term for this help text is "ToolTip," and Microsoft's Visual Basic .NET supports ToolTips very well.
Instructions
-
-
1
Start the Visual Basic programming environment and click "New Project" on the Visual Basic Start Page.
-
2
Double-click the "Windows Forms Application" item to open a blank form in a new project.
-
-
3
Expand the Toolbox on the top left of the Design windows by scrolling the cursor over it. Double-click the "TextBox" control and the "Button" control to add a TextBox and a Button to the form. Double-click the "ToolTip" control twice to add two ToolTips to the tray at the bottom of the Design window. Close the Toolbox by clicking anywhere in the form.
-
4
lick on "TextBox1" to select it. Scroll down in the Properties windows located on the lower right of the Design window to locate the "ToolTip on ToolTip1" property. Enter the text that you want to appear on the form when the user first scrolls over "TextBox1" in the field on the right. Enter the text that you want to appear on the form if the user leaves the cursor on the field for several seconds in the field to the right of the "ToolTip on ToolTip2" property. Repeat this step for the "Button1" control.
-
5
Select "ToolTip2" in the tray at the bottom of the Design window. Scroll through the Properties window to locate the "Automatic Delay" property and set it to "2000." Set the "AutomaticPopDelay" to "10000." Locate the "IsBalloon" property and set it to "True." The new values cause "ToolTip2" to delay before displaying and displays it in a balloon rather than a box.
-
6
Test your work by using the "Debug" feature of Visual Basic. Click on the "Debug" menu item at the top of the screen and select the "Start debugging" menu item. Visual Basic will open your new form in debug mode. Roll your cursor over "TextBox1" and you should see your "ToolTip1" verbiage appear. Leave the cursor there for several seconds and you should see the "ToolTip2" verbiage appear. Repeat this procedure for "Button1" to verify correct behavior.
-
1
References
Resources
- Photo Credit Hemera Technologies/AbleStock.com/Getty Images