Keyboard: CTRL + K, CTRL + C (comment); CTRL + K, CTRL + U (uncomment)
Menu: Edit -> Advanced -> Comment Selection; Edit -> Advanced -> Uncomment Selection
Command: Edit.CommentSelection; Edit.UncommentSelection
Download the seriously cool Tip of the Day Extension to get the daily tips delivered to your Start Page!
Sometimes it's the simple stuff we forget about. So I present to you the classic Comment and Uncomment Selection. Naturally, you have the Comment and Uncomment buttons:
And, of course, we have the Menu items:
But it's the keyboard shortcuts that really rock! These will, predictably, comment or uncomment lines of code for you. So, let's say you have some code you want commented out. Just select it:
Then press CTRL + K, CTRL + C (in this example):
Voila! It's commented out. Okay, great, but what if you don't want to use the mouse? No problem! Just hold ALT + SHIFT + [UP or DOWN ARROW] to do a vertical selection (NOTE: In VS2008 you have to go right or left one character before you can go up or down for vertical selection):
Then press CTRL + K, CTRL + U (in this example):
And there you go! Comment and Uncomment actions anytime you want!