Share via


Typographic and Code ConventionsĀ 

Visual Basic documentation uses the following typographic and code conventions.

Typographic Conventions

Convention Description

Sub, If, ChDir, Print, True, Debug

Words in bold with initial letter capitalized indicate language-specific keywords or runtime members.

SmallProject, ButtonCollection

Words and phrases you are instructed to type appear in serif font.

Module Statement

Words and phrases in an underlined, colored font are hyperlinks you can click to go immediately to a relevant Help page.

object, variablename, argumentlist

Italic letters indicate placeholders for information that you supply.

[ Shadows ], [ expressionlist ]

In syntax, items inside brackets are optional.

Public | Friend | Private }

In syntax, curly braces and vertical bars indicate a mandatory choice between two or more items. You must choose one, and only one, of the items.

Protected | Friend ]

In syntax, square brackets and vertical bars indicate two or more independent options. You can choose any combination, or none, of the items.

[{ ByVal | ByRef }]

In syntax, square brackets surrounding curly braces and vertical bars indicate that you can choose no more than one item, but you can also omit the items entirely.

membername1, membername2, membername3

Subscripts differentiate multiple instances of the same placeholder.

memerbname1

...

membernamen

In syntax, ellipses indicate an indefinite number of items of the kind immediately preceding the ellipses.

In code, ellipses signify code omitted for the sake of clarity.

ESC, ENTER

Words in capital letters indicate key names and key sequences on your keyboard.

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

Sample code Description

sampleString = "Hello, world!"

The preceding statement sets the value of sampleString to "Hello, world!".

A fixed pitch font is used for code samples, as well as for code elements in explanatory text.

' This is a comment.
REM This is also a comment.

An apostrophe (') or the REM keyword introduces code comments.

sampleVar = "This is an " _
    & "example" _
    & " of how to continue code."

A space followed by an underscore ( _) at the end of a line continues the source code statement.

See Also

Tasks

How to: Break and Combine Statements in Code

Reference

Visual Basic Language Keywords
Visual Basic Run-Time Library Members

Concepts

Visual Basic Naming Conventions
Comments in Code

Other Resources

Visual Basic Reference