Users Online
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Latest Articles
Articles Hierarchy
Visual Basic Comments
Visual Basic Comments
In Visual Basic, Comments are the self-explanatory notes to provide detailed information about the code which we wrote in our applications.
By using comment symbol ('
), we can comment on the code in our Visual Basic programming. The comment symbol ('
) will tell the Visual Basic compiler to ignore the text following it, or the comment.
It’s always a good practice to include the comments in your Visual Basic code to provide detailed information about the functionality like what the specific block or line of code can do and it will be a benefit for anyone else who examines the code.
In Visual Basic, we can include the comments anywhere in the program without effecting our code and the comments in Visual Basic do not affect the performance of an application because the comments won’t be compiled and executed by the compiler.
Following is the example of defining the comments in Visual Basic programming language.
' Show Greet Messaging
Console.WriteLine("Welcome to Tutlane.com")
Console.ReadLine() ' This method to read the commands from a console
In case, if you want to comment more than one line, use the comment symbol ('
) on each line like as shown below.
' Show Greet Messaging
' Multiple line comments
Visual Basic Comments Example
Following is the example of defining the comments in Visual Basic programming language.
Module Module1
Sub Main()
' Calling Method to Show Greet Messaging
GreetMessage()
Console.WriteLine("Press Any Key to Exit..")
Console.ReadLine() ' This method to read the commands from a console
End Sub
' This Method will display the welcome message
Public Sub GreetMessage()
Console.WriteLine("Welcome to Tutlane")
End Sub
End Module
If you observe the above example, we defined multiple comments by using comment symbol ('
) to provide information about functionality.
When we execute the above Visual Basic program, we will get the result as shown below.
Press Any Key to Exit..
This is how we can use the comments to provide detailed information about the functionality of our Visual Basic application.
In visual studio, we can use the following keyboard shortcuts to comment/uncomment the selected lines of code based on our requirements.
To comment keyboard shortcut is Ctrl + K, C and to uncomment keyboard shortcut is Ctrl + K, U.