Standard Prefixes (For all Beginners, Intermediate, and Advanced)

Submitted on: 1/21/2015 1:43:00 PM
By: Ravage (from psc cd)  
Level: Intermediate
User Rating: By 4 Users
Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 401
     When naming a control, it is recomended that you start the name with a three-letter prefix that helps you identify what kind of control you are referencing. For example, a form should be called frm1 instead of Form1. Also I've included one piece of code that everyone should include in their projects.


New Page 1

Here are some standard prefixes for commonly used controls.
Prefix: Control:
ani Animation button
cbo Combo box
ch3 3D Check box
chk Check box
clp Picture clip
cm3 3D Command button
cmd Command Button
ctr Control (specific type unknown)
dat Data
dir Directory list box
dig Common dialog box
drv Drive list box
fil File list box
fr3 3D Frame
fra Frame
frm Form
gpb Group push button
gra Graph
grd Grid
hsb Horizontal scroll bar
img Image
ils Image list
lbl Label
lin Line
lst List box
mci Multimedia MCI
mnu Menu
opt Option button
pic Picture box
prg Progress bar
shp Shape
sli Slider
spn Spin button
tlb Toolbar
tmr Timer
tre Tree view
txt Text box
vtb Vertical scroll bar

Also remember to include "Option Explicit" w/out the quotation marks in your declarations. This small piece of code requires that a variable's name be declared before they are used in code. VERY IMPORTANT. Remember to add this to all of your projects, because it will help you in so many ways! Another way to include Option Explicit in your program is to select Tools | Options from the menu bar. Under the Editor tab, one of the settings is Require Variable Declaration. When selected, any new module automatically has Option Explicit in its General Declarations section.

Other 2 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.