Typographic conventions
Visual Basic documentation uses the following typographic conventions.
Convention | Description |
---|---|
Sub, If, ChDir, Print, True, Debug | Words in bold with initial letter capitalized indicate language-specific keywords. |
Setup | Words you are instructed to type appear in bold. |
object, varname, arglist | Italic, lowercase letters indicate placeholders for information you supply. |
pathname, filenumber | Bold, italic, and lowercase letters indicate placeholders for arguments where you can use either positional or named-argument syntax. |
[ expressionlist ] | In syntax, items inside brackets are optional. |
{While | Until} |
In syntax, braces and a vertical bar indicate a mandatory choice between two or more items. You must choose one of the items unless all of the items are also enclosed in brackets. For example: [{This | That}] |
ESC, ENTER | Words in capital letters indicate key names and key sequences. |
ALT+F1, CTRL+R | A plus sign (+) between key names indicates a combination of keys. For example, ALT+F1 means hold down the ALT key while pressing the F1 key. |
Code conventions
The following code conventions are used.
This font is used for code, variables, and error message text.
Sub HelloButton_Click()
Readout.Text = "Hello, world!"
End Sub
An apostrophe ('
) introduces code comments.
' This is a comment; these two lines
' are ignored when the program is running.
Lines too long to fit on one line (except comments) may be continued on the next line by using a line-continuation character, which is a single leading space followed by an underscore ( _
):
Sub Form_MouseDown (Button As Integer, _
Shift As Integer, X As Single, Y As Single)