IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
VB Classic
Search VB Classic Group:

Advanced
-Collapse +Expand VB Classic Store

Prestwood eMagazine

March Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingVB ClassicTool Basics   Print This     
  From the January 2016 Issue of Prestwood eMag
 
VB Classic Tool Basics:
VB Classic Comments (' or REM)
 
Posted 11 years ago on 11/14/2008 and updated 1/29/2009
VB Classic Code Snippet:
 A flashcard from our VB Classic Flashcards Library
 A code snippet from our VB Classic Code Snippets Page

KB101507



Languages Focus: Comments

Commenting code generally has three purposes: to document your code, for psuedo coding prior to coding, and to embed compiler directives. Most languages support both a single line comment and a multiple line comment. Some languages also use comments to give instructions to the compiler or interpreter.

VB Classic Comments

Commenting Code
VB Classic, like all the VB-based languages, uses a single quote (') or the original class-style basic "REM" (most developers just use a quote). VB Classic does NOT have a multiple line comment.

Directives - #

Directives are sometimes called compiler or preprocessor directives. A # is used for directives within VB Classic code. VB Classic offers only an #If..then/#ElseIf/#Else directive.

Syntax Example:
'Single line comment.

REM Old school single line comment.

#If MyDirective Then
'...some code.
#End If

 

Multi-Line Comment Code Trick

You can simulate a multi-line comment with code which is useful especially if you wish to comment out a block of code.

For example:

If False Then
 '...code here skipped.
End If

Using Directives

Here is a simple example of using VB Classic's directive (change True to False to switch it).

#Const MyDirective = True

#If MyDirective Then
   MsgBox ("Yes")
#Else
   MsgBox ("No")
#End If

More Info


Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1241A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #101507 Counter
12418
Since 11/14/2008
-
   Contact Us!
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


Go ahead!   Use Us! Call: 916-726-5675 


©1995-2019 Prestwood IT Solutions.   [Security & Privacy]