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.
- In Visual Studio, right click on the toolbar and select Customize... menu
- Ignoring the Customize dialog, right click on the Comment Selection button on the toolbar.
- 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.
- Right click on the Comment Selection button again and select Image and Text.
- Dismiss the Customize dialog box.
- Now highlight any block of code and press Alt+C. Voila.
- Do the same thing for the Uncomment Selection button, but rename the button to &xUncomment. Now you can use Alt+X to uncomment code.
