Tipografia e convenções de código (Visual Basic)
Visual Basic documentation uses the following typographic and code conventions.
Typographic Conventions
Example |
Description |
---|---|
Sub, If, ChDir, Print, True, Debug |
Language-specific keywords and runtime members have initial uppercase letters and are formatted as shown in this example. |
SmallProject, ButtonCollection |
Words and phrases you are instructed to type are formatted as shown in this example. |
Links you can click to go to another Help page are formatted as shown in this example. |
|
object, variableName, argumentList |
Placeholders for information that you supply are formatted as shown in this example. |
[ Shadows ], [ expressionList ] |
In syntax, optional items are enclosed in brackets. |
{ Public | Friend | Private } |
In syntax, when you must make a choice between two or more items, the items are enclosed in braces and separated by vertical bars. You must select one, and only one, of the items. |
[ Protected | Friend ] |
In syntax, when you have the option of selecting between two or more items, the items are enclosed in square brackets and separated by vertical bars. You can select any combination of the items, or no item. |
[{ ByVal | ByRef }] |
In syntax, when you can select no more than one item, but you can also omit the items completely, the items are enclosed in square brackets surrounded by braces and separated by vertical bars. |
nome de associado1, nome de associado2, nome de associado3 |
Multiple instances of the same placeholder are differentiated by subscripts, as shown in the example. |
memberName1 ... memberNameN |
In syntax, an ellipsis (...) is used to indicate an indefinite number of items of the kind immediately in front of the ellipsis. In code, ellipses signify code omitted for the sake of clarity. |
ESC, ENTER |
Key names and key sequences on the keyboard appear in all uppercase letters. |
ALT+F1 |
When plus signs (+) appear between key names, you must hold down one key while pressing the other. For example, ALT+F1 means hold down the ALT key while pressing the F1 key. |
Code Conventions
Example |
Description |
---|---|
sampleString = "Hello, world!" |
Code samples appear in a fixed-pitch font and are formatted as shown in this example. |
The previous statement sets the value of sampleString to "Hello, world!" |
Code elements in explanatory text appear in a fixed-pitch font, as shown in this example. |
' This is a comment. REM This is also a comment. |
Code comments are introduced by an apostrophe (') or the REM keyword. |
sampleVar = "This is an " _ & "example" _ & " of how to continue code." |
A space followed by an underscore ( _) at the end of a line indicates that the statement continues on the following line. |
Consulte também
Tarefas
Como: Quebrar e combinar instruções no código (Visual Basic)
Referência
Membros da biblioteca de tempo de execução do Visual Basic
Conceitos
Convenções de nomeação do Visual Basic
Comentários em código (Visual Basic)