In VB . NET, you write a comment by writing an apostrophe ' or writing REM . This means the rest of the line will not be taken into account by the compiler.
Write your chunk, select it and press Ctrl+K, Ctrl+C to comment it.
The leading characters // are added to the beginning of each line when commenting one or more lines of code. You can also block comment multiple lines of code using the characters /* */ .
VB doesn't have such a construct at the language level. It has single line comments using apostrophe character:
' hello world
' this is a comment
Rem this is also a comment
However, Visual Studio has a functionality to automate this task. Select the lines you want and press Ctrl+K+C for commenting and Ctrl+K+U for uncommenting (General Development Settings shortcuts, look at the "Edit ->
Advanced" menu while selecting some code to see the shortcuts).
Totally abusing compiler directives here... but:
#If False Then
Comments
go
here
#End If
You don't get the benefits of proper code coloration (it doesn't show in green when using the default color scheme) and the implicit line-continuation system automatically indents lines in a paragraph starting at the second line. But the compiler will ignore the text.
The other answers explain how to comment/uncomment automatically in VB.NET. Just for completeness, in VB6 use these toolbar buttons: . More details here.
Here is a cludgy way to make a multiline comment which is also collapsible.
If <![CDATA[ Multiline comment about this and that
Comment about this
and that and so on
with lots of lines
]]> Is Nothing Then : End If
It looks like this when you collapse it
If <![CDATA[ Multiline comment about this and that ... Is Nothing Then : End If
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With