Start a comment with a single quote mark. This tells the computer to ignore everything on the line after the quote mark. For example:
' This is how to write a comment in Visual Basic
' Comments can be more than one line
' Each comment must start with a single quote mark
Start the comment line with "REM," which indicates a remark. This is an older way to add comments to Visual Basic code. For example:
REM This is how to write a comment in Visual Basic
REM Comments can be more than one line
REM Each comment must start with the word REM
Comments can appear anywhere in your code, even at the end of an executable line. You must put a colon before the REM if it does not appear at the start of the line, but a colon is not required before a single quote. Here are two examples, the first using a single quote and the second using the REM statement:
' Create a message box that says Hello, World!
Sub Main()
MsgBox("Hello, World!") ' Comments can appear anywhere in code
End Sub
REM Create a message box that says Hello, World!
Sub Main()
MsgBox("Hello, World!") : REM Comments can appear anywhere in code
End Sub
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.