ARTICLE

Comments in VB.NET

Posted by Mahesh Chand Articles | Visual Basic Language May 04, 2010
Learn how to place comments in VB.NET code.
 
Reader Level:

Comments

 VB.NET supports two ways to implement comments in code. First, the old Visual Basic way using a REM keyword followed by comment and second, the new VB.NET way, using a single quote. Visual Studio 2010 also support automated comments. If you use three single quotes at top of a function or method and hit ENTER, you will see pre-formatted comments help is generated as you can see from Listing 2. Listing 2 shows both REM and single quote approach for comments.


 ''' <summary>

    ''' This is automated generated standard comment in Visual Studio

    ''' Use thre singe quotes and hit ENTER, it will generate summary and

    ''' other comments for the entire function

    ''' </summary>

    ''' <param name="NumberOne"></param>

    ''' <param name="NumberTwo"></param>

    ''' <returns></returns>

    ''' <remarks></remarks>

    Function LineContinuationSnippet(ByVal NumberOne As Integer, _

                                     ByVal NumberTwo As Integer) _

                                     As Integer

 

        ' Check if NumberOne > NumberTwo

        If (NumberOne > NumberTwo Or _

            NumberOne = NumberTwo) Then  ' If True, then go here

            REM Return NumberOne

            Return NumberOne

        Else

            REM Return NumberTwo

            Return NumberTwo  ' REM can be used here too

        End If

 

    End Function 

Listing 2


 
Read this article to learn more about Comments in VB.NET


   

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor