XTab's Blog

Ged Mead's Blog at vbCity

vbCity Blogs moved to:
http://cs.vbcity.com/blogs
  Home :: Syndication  :: Login

OctNovember 2009Dec
SMTWTFS
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Archives

Topics

Ramblings

VB.NET

   Here's a little tip.   Actually, it's so small that it's probably no more than a Tipette, A Tipchen (for German readers) or a Tipling ....  oh wait!  Isn't that what I do every night after work? 

   Anyway, enough preamble.   If you are in one of those not uncommon situations where you temporarily want your project to ignore a block of code, how do you do this?      Maybe your preferred way is to comment out each of the lines in that code block?     That is, manually go down line after line and insert the apostrophe, using the down arrow...?  If so, I have good news for you: there is a much easier way.

   Here's how.   There is a really handy set of key press combinations you can use in Visual Studio.

   To comment out a block:

1.        Select the block you want to comment out by dragging over it with the mouse and with the left mouse button held down.

2.        Press the Ctrl key and the letter K key at the same time.  (Nothing visible will happen yet.)

3.        Release those two keys.

4.        Then press the Ctrl key and the letter C key at the same time.

5.        Automagically, the selected code block will be commented out.   It’s a real time saver.

 

To uncomment a block of code back in again, follow all the steps above, except that in Step 4 you use the Ctrl key and the letter U (for Uncomment) at the same time.   Neat. Huh?

 

  

posted on Wednesday, March 08, 2006 5:38 AM