Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
  Tip: Comment Long Sections of Code By Using Conditional Compilation  
 
 

Thanks to Jack Schitt.

In vb.net 2003 (possibly in other versions as well, and possibly as far back as vb6 [That's true. Rod]) long sections of comments can be inserted in code, similar to the /* blah blah blah */ convention used in C, C++, and C#.

This is done using the conditinal compiling directive #If.

    #If False Then
        Everything here will be ignored by the compiler and
        (as tested in VB .Net 2003) the IDE
    #End If

The #If and #End If must be on their own line, but obviously everything in between is ignored by the compiler (though the syntax highlighter still colors keywords)

It should also be noted that in VB .Net 2003, code outline and intellisence are disabled in conditional compilation sections that currently evalutate to false or not compiled. [Intellisense still works in VB 6. Rod]

 

Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated