Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
How to Add Comments in Visual Basic
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Adding comments to your Visual Basic code is a helpful practice that can make your code more readable and understandable to other developers. Here's how to add comments in Visual Basic: 1. Single-Line Comments: Single-line comments are created using an apostrophe (') character. To add a comment to a single line, simply place the apostrophe before the text you want to comment, like this: ``` ' This is a single-line comment in Visual Basic ``` Anything after the apostrophe character is considered a comment and will be ignored by the compiler. 2. Multi-Line Comments: To add a comment that spans multiple lines, use the following syntax: ``` ' This is a ' multi-line comment ' in Visual Basic ``` You can also use the REM keyword to create multi-line comments: ``` REM This is a REM multi-line comment REM in Visual Basic ``` 3. XML Comments: In Visual Basic, you can also add XML comments to your code. These comments are specially formatted and can be used to generate documentation for your code. To add an XML comment, use the following syntax: ``` ''' <summary> ''' This is an XML comment in Visual Basic ''' </summary> ``` Note that XML comments start with three apostrophes (''') and are enclosed in XML tags. By adding comments to your code, you can make it easier to understand and maintain. It's a good practice to add comments as you write your code, rather than trying to remember to add them later.
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)