Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Jul 24, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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 If
End Sub

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

Frewin Chan
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date