Naming GuidelinesTo help with the readability of code it is advisable to give your variables names that are meaningful.
In the following example Calculating the amount of pay based on hours worked and a hourly rate.
Which is easier to read and understand;-
CODE
C=A*B
or
CODE
PayPacket = HourlyRate * HoursWorked
This isn't restrict to variables I would suggest you apply it to your controls as well.
When you Drag & Drop a control from the toolbox on to the form design, the designer automatically gives your control a name. E.g.
TextBox1
TextBox2
TextBox3
PictureBox1
Button1
Button2
This is ok for uniquely identifying them but useless for readability, as they have no meaning or context.
In the properties windows, clicking in the name property
and give them better one.
I generally use the follow format for my controls.
Format:
<3letters>_
<Name>
Frm Form
But Button
Lbl Label
Txt Text
Pic PictureBox
Pro ProgressBar
Lst Listbox
A few examples;
Frm_Main
Frm_Recipt
But_CalculateVat
But_Cancel
But_OK
Lbl_Author
Txt_AuthorName
Txt_BookTitle
Txt_Price
Pic_FacePictureSo from now on you gonna be a meaningful variable & control naming code ninja.
