The most important property for any control is its name. Careful naming of your controls will make programming much easier. There are a few rules for naming controls and also some conventions. A convention is what people usually do to make things easier to understand.
Rules:
Control names cannot have more than 40 characters
The name must start with a letter
It can only contain letters, numbers and the underscore _ character
Conventions:
In Visual Basic programming, the first 3 letters (called a prefix) of the name of a control tell you what type of control it is. Some of the common prefixes used are:
|
Control |
||
| Form | frm | |
| Command Button | cmd | |
| Label | lbl | |
| Text Box | txt | |
| Check Box | chk | |
| Option Button | opt |
The rest of the name usually shows what the control does. It also usually starts with an upper case letter.
So cmdBeep might be the name of a command button that causes a beep, optGreen might be the green option, lblChoice might be the label showing the user's choice etc.
![]() |
|


