Comments of multiple lines in Visual Basic

Asked

Viewed 6,412 times

3

It’s like I put multiple-line comments in Visual Basic?

2 answers

5


Unfortunately, there is no way to create a multi-line comment in the BASIC language, but there are some "tricks" that we can do:

Trick 1: #If

You can try creating blocks #If with nonexistent expressions, this compiler will ignore the block. Example:

#If Comentario Then
     Isso é
     um comentário
     de várias linhas
#End If

Trick 2: REM

Same thing as the character ', you can set as in the example:

REM linha 1
REM linha 2
REM linha 3

Trick 3: Ctrl+K, Ctrl+C (Visual Studio 2008 only+)

This is simple, just enter the code, select what you want to comment and press Ctrl+K (only in Visual Studio 2008+)

1

Faster and easier mode (has buttons on top panel):

  • Select the lines -> For comment: Ctrl+K, Ctrl+C
  • Select the lines -> To remove comment: Ctrl+K, Ctrl+U
  • This shortcut is to Visual Studio Code or to Visual Basic??

  • To both, because try to use the same pattern. I confirmed by looking in the documentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.