1. Home
  2. Computing & Technology
  3. Visual Basic

Chapter 3 - Working With ToolBox Controls

By Dan Mabbutt, About.com

6 of 6

One last tip ...

Block Comment

Block Comment

One last tip before signing off on this lesson. As you're working on the assignment, you might be able to use this idea.

The book discusses comments and how they're used. Providing explanations in the program source code is a major use of comments, but an equally popular use is to temporarily disable program statements while you're working on the code.

For example, consider the MsgBox statements. This is a perfectly adequate way to display results to the program user, but they interrupt the flow of the program as they're displayed. Suppose you were having trouble with a different part of the program and you knew that these statements were correct. As you run the program to test the other part, you have to click OK to get rid of each MsgBox statement. Wouldn't it be great to just have the program skip past them temporarily?

If you simply turn each statement into a comment, that's exactly what happens. VB.NET even has a block comment and block uncomment toolbar button so you can do a group of them at one time. You can see what that looks like for three MsgBox statements at the bottom of the page.

And finally, an explanation. This lesson doesn't discuss the Installing ActiveX Controls section of Chapter 3 because the book doesn't do anything except install the control. My philosophy is that software is there to be used. Installing the control without using it is sort of like "programming interruptus" - not very satisfying.

Happy Coding!

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB.NET
  5. Working With ToolBox Controls

©2009 About.com, a part of The New York Times Company.

All rights reserved.