How to comment / uncomment code faster.

This one applies to VS2002, VS2003, VS2005, VS2008, Visual Basic 4/5/6.  People are always surprised when I show it to them. What if you could just highlight code and press Alt+C to comment it out or Alt+X to uncomment it.

  1. In Visual Studio, right click on the toolbar and select Customize... menu
  2. Ignoring the Customize dialog, right click on the Comment Selection button on the toolbar.
  3. An interesting menu will popup.  Under Name, change the entry to &Comment. So now instead of Comment Selection it should read &Comment.  Press Enter to record the change.
  4. Right click on the Comment Selection button again and select Image and Text.
  5. Dismiss the Customize dialog box.
  6. Now highlight any block of code and press Alt+C.  Voila.
  7. Do the same thing for the Uncomment Selection button, but rename the button to &xUncomment.  Now you can use Alt+X to uncomment code.

imgQuickComment1