Tool Tips

When you want to know what a button on the toolbar is for, you move the mouse over the control and look at the tool tip that appears. For example, if you move the mouse over the green arrow on the toolbox, you see the tool tip "Start Debugging." tooltip example
In the toolbox find the TooTip control ToolTipand add it to the Form. The ToolTip does not actually appear on the form, but in the area under the Form. Next, scroll through the properties for the PictureBox and find a new property called ToolTip on ToolTip1. Run the program and move the mouse over the picture of the computer to see the tooltip.

Names

Visual Basic gives controls a default name: the first label is named Label1; the second label will be Label2, and so on. It is important to change the names of the controls; lblGreeting and picComputer are easier to work with than trying to remember whether Picture1 is the computer or the printer. It is a good habit to name the control as soon as you add it to the form. You are probably think something like, "I need a label to display a greeting," so immediately naming the label LblGreeting makes sense. In order to make our projects easier to work with, we will start giving our controls names. It will make writing and debugging your program easier if you use a standard prefix for each type of control: Btn for Buttons, Txt for text boxes, Lbl for labels, etc. The table shows the suggested prefixes. Most of these controls will be discussed in more detail later.

The (Name) property is inside parenthesis and is almost at the top of the property list.

When you type a name for a control you can not use any spaces or any special characters except the underscore. Most programmers use what is sometimes called "Camel Case" - each "word" in the name begins with a capital letter. It is easier to understand TxtLastName, than txtlastname or Text1.


INDEX, Controls, Adding Pictures, The PictureBox Control, Tool tips and Naming controls, List of Controls, Hot Spots
Next lesson: Writing Code in Visual Basic

Copyright © Zebra0.com
All rights reserved worldwide.

 
 

Tool tips and Naming controls