

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


8/25/ Comments : A) Header โ should conform to the following arrangement:
โ Form (file): frmDemo (frmdemo.vb) โ Programmer: John Doe โ Assignment: # โ Due Date: 11/11/ โ Description: One or more lines describing what the form/module does
B) Procedure โ each procedure/function should have a descriptive comment at the top (this should include a description of any arguments)
C) General โ any significant/unusual code should be commented (above or along side)
Spacing : A) Indentation โ should be consistent (Tab value of 4 recommended)
B) Lines should not be longer than your printer can handle. Use the _ continuation character to continue on the next line (and indent each continuation line). You can use the separator line shown in C) below as a guide to indicate the printer page width โ for example, I put the last dash in column 86, and never write code beyond that point.
C) Put a blank line, followed by a separator line, at the top of each procedure.
โ------------------------------------------------------------------------------------------------------------ โ This is a comment explaining what the procedure does Private Sub btnQuit_Click() โ first line of actual procedure (next line indented) Dim intCounter As Integer โ and so on End Sub
โ------------------------------------------------------------------------------------------------------------ โ This is a comment explaining what the procedure does Private Sub btnClear_Click() โ first line of actual procedure (next line indented) Dim strName As String โ and so on End Sub
D) If you declare more than two or three variables at the top of a procedure, consider separating them from the remaining code with a blank line.
E) Do not add other blank lines to your code unless you have a justifiable reason for doing so.
F) Remove any empty event procedures (skeletons) from your code - these usually are the result of accidentally double-clicking on a given control in Design View, even though you donโt intend to write code for the associated event procedure.
Naming : A) Objects/Controls โ use standard three-character prefix, followed by descriptive name:
txtZipCode โ for a textbox intended to accept a userโs zipcode btnQuit โ for a button that allows the user to quit the form lblLastName โ for a label intended to display a last name
B) Variables โ use three-character prefix, followed by descriptive name:
Dim intCounter As Integer Dim strName As String Dim dblSubTotal As Double Dim decEarnings As Decimal
The above declarations are for local (procedure-level) variables. If are variable is module-level, it should start with the letter โmโ:
Private mintCounter As Integer Private mstrName As String Private mdblSubTotal As Double Private mdecEarnings As Decimal
C) Constants โ use all upper case. Because VB (internally) treats constants differently than variables, the scope issue is not as critical regarding constants. I recommend you place all your constant declarations at the top of each module (just before your module- level variable declarations).
Const MAX As Integer = 100 Const COMPANYNAME As String = โJoeโs Pizzaโ
D) Routines (Sub Procedures and Functions) โ use
CalculatePay - procedure that calculates pay CheckData - procedure that checks the validity of data
Notes : A) Always place Option Strict On at the top of each form/module.
B) Be sure to label any disk you turn in as part of an assignment.
C) Staple code printouts in order.