Visual Basic Concepts
This documentation uses the following typographic conventions.
Example of convention | Description |
Sub, If, Case Else, Print, True, BackColor, Click, Debug, Long | Words with initial letter capitalized indicate language-specific keywords. |
setup | Words you’re instructed to type appear in bold. |
event-driven | In text, italic letters can indicate defined terms, usually the first time they occur in the book. Italic formatting is also used occasionally for emphasis. |
variable | In syntax and text, italic letters can indicate placeholders for information you supply. |
[expressionlist] | In syntax, items inside square brackets are optional. |
{While | Until} | In syntax, braces and a vertical bar indicate a choice between two or more items. You must choose one of the items unless all of the items also are enclosed in square brackets. |
|
This font is used for code. |
ENTER | Capital letters are used for the names of keys and key sequences, such as ENTER and CTRL+R. |
ALT+F1 | A plus sign (+) between key names indicates a combination of keys. For example, ALT+F1 means to hold down the ALT key while pressing the F1 key. |
DOWN ARROW | Individual direction keys are referred to by the direction of the arrow on the key top (LEFT, RIGHT, UP, or DOWN). The phrase "arrow keys" is used when describing these keys collectively. |
BACKSPACE, HOME | Other navigational keys are referred to by their specific names. |
c:\Vb\Samples\Calldlls.vbp | Paths and file names are given in mixed case. |
The following guidelines are used in writing programs in this manual. For more information, see Programming Fundamentals in the Programmer's Guide.
' Sub, If, ChDir, Print, and True are keywords.
Print "Title Page"
ErrorHandler:
Power = conFailure
End Function
'
) introduces comments:
' This is a comment; these two lines
' are ignored when the program is running.
Private Sub cmdRemove_Click ()
Dim Ind As Integer
Ind = lstClient.ListIndex ' Get index.
' Make sure list item is selected.
If Ind >= 0 Then
lstClient.RemoveItem Ind ' Remove it
' from list box.
' Display number.
lblDisplay.Caption = lstClient.ListCount
Else
Beep ' If nothing selected, beep.
End If
End Sub
Sub Form_MouseDown (Button As Integer, _
Shift As Integer, X As Single, Y As Single)
vbTileHorizontal
dbAppendOnly
xlDialogBorder
Throughout this book, user-defined constants are usually prefaced with "con" and are mixed case. For example:
conYourOwnConstant
When using Windows API constants, however, the code examples still follow the same conventions as in previous versions of Visual Basic. For example:
EM_LINESCROLL