Comment Multiple Lines

Comment Multiple Lines

VB provides only single-line comment functions: “REM” and “‘”. If you’re looking for another way to comment out a block of code, use conditional compilation in VB4 instead. Define “COMMENT = 0” in the Conditional Compilation Arguments field on the Advanced tab in the Options dialog of the Tools menu:

 Public Sub TestingSub()	Print "This subroutine is used to" 	Print "demonstrate block"	Print "commenting in VB."#If COMMENT then	Print "This line will not be printed."	Print "Since this is commented out."	Print "VB ignores these lines during compilation."#End IfEnd Sub

This trick also works with VB5, but you might find the Comment Block command on the Edit toolbar much handier.


Share the Post: