Showing posts with label VisualStudio. Show all posts
Showing posts with label VisualStudio. Show all posts

Monday, August 8, 2016

5 Great Visual Studio Keyboard Shortcuts

Following are five of my favorite keyboard shortcuts in Microsoft Visual Studio.

1)Move Code Alt+Up/Down

This keyboard shortcut is new in Visual Studio 2013. If you put the cursor on a line of code and use the Alt+Up Arrow keys, the line of code you've selected moves up. If you use the Alt+Down Arrow keys, the line of code selected moves down.

2)Create Collapsible Region Ctrl+M+H/Ctrl+M+U

Chances are you've noticed the "+" and "-" symbols in the margins that let you collapse and expand your classes and functions. Did you know you can create your own collapsible regions? If you select a section of code and then use the key sequence Ctrl+M+H, you turn that region into a collapsible/expandable region. The key sequence Ctrl+M+U will remove the collapsible region. It doesn't delete the code, it just removes the icon that lets you expand and collapse.

3)Comment Code Block Ctrl+K+C/Ctrl+K+U

Whether it's because you're trying to track down a "but," or experimenting with code change, from time to time you'll want to comment and uncomment blocks of code. If you select a block of code and use the key sequence Ctrl+K+C, you'll comment out the section of code. Ctrl+K+U will uncomment the code.

4)Peek Definition Alt+F12

When you're going through your code and you want to examine the code in the method you're calling, many programmers will use the F12 key or the pop-up menu option Go To Definition. Go To Definition will navigate to the called method; however, many times you don't need to navigate to the code. Sometimes, you just want a quick look at the method. If you've installed Visual Studio 2013, there's a new keyboard shortcut -- Alt+F12 -- that will give you a preview of the method being called inline. You can use the Esc key to close the preview.

5)Navigate Forward/Backward Ctrl+–/Ctrl+Shift+–

When you have multiple files open at the same time, you might want a way to quickly move back and forth between two or three different locations in your code. If you've moved from one location to another you can use the keyboard sequence <Ctrl>+– to move to the previous location and then you can return using Ctrl+Shift+–.

Monday, May 2, 2016

Visual Studio Keyboard Shortcuts


To format document in visual studio
Ctrl + K, D

To comment selected code
Ctrl + K, C

To uncomment selected code
Ctrl + K, U

Show intellisense
Ctrl + Space

Covert selected text to UPPERCASE
Ctrl + Shift + U

Covert selected text to LOWERCASE
Ctrl + U

Toggle Full Screen
Alt + Shift + Enter

Build Project
Shift + F6

Build Solution
Ctrl + Shift + B OR F6

Attach the debugger to a process
Ctrl + Alt + P

Expand or Collapse current element
Ctrl + M, M

Collapse all
Ctrl + M, O

Toggle all Outlining
Ctrl + M, L