Block commenting VB/VB.NET code

前端 未结 12 1028
死守一世寂寞
死守一世寂寞 2020-12-06 03:57

How to comment multiple lines of code/block of code in VB?

相关标签:
12条回答
  • 2020-12-06 04:28

    The other answers explain how to comment/uncomment automatically in VB.NET. Just for completeness, in VB6 use these toolbar buttons: alt text. More details here.

    0 讨论(0)
  • 2020-12-06 04:33

    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
    
    0 讨论(0)
  • 2020-12-06 04:39

    To comment out a big section of code you highlight the code you want to comment out, then you hit ctrl+K, then hit ctrl+C. To un-comment a block of commented code you hit ctrl+K, then hit ctrl+U.

    0 讨论(0)
  • 2020-12-06 04:41

    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.

    0 讨论(0)
  • 2020-12-06 04:42

    Select the lines you need to comment and press keys CTRL+K+C.

    If you need to uncomment use CTRL+K+U

    0 讨论(0)
  • 2020-12-06 04:42

    install MZ-Tools and you can use CTRL+SHIFT+C to comment code blocks and CTRL+SHIFT+U to uncomment code blocks.

    You can also define your own key-combinations:

    MZ-Tools

    0 讨论(0)
提交回复
热议问题