devxlogo

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.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist