Top 10 Visual Studio Keyboard Shortcuts

Top 10 Visual Studio Keyboard Shortcuts

23 Dec 2023
Intermediate
85.8K Views
7 min read

Top 10 Visual Studio Keyboard Shortcuts: An Overview

Playing with keyboard shortcuts is very interesting and reduces the headache of using the mouse again and again while programming with Visual Studio IDE. Keyboard shortcuts also enhance your productivity and make your programming life easy and convenient. So, I decided to share a list of the top 10 Visual Studio keyboard shortcuts that are amazing and very helpful, for more shortcuts refer to the article Visual Studio Useful Keyboard Shortcut Keys.

F5 & Ctrl-F5

  • F5: Builds and executes your project so you can check the functioning of your code right away.
  • Ctrl+F5: Using the keyboard shortcut Ctrl+F5, you can enter debug mode and step through your code line by line, analyze variables, and find possible problems.
Visual Studio Keyboard Shortcut - F5 & Ctrl-F5

F7 & Shift-F7

  • F7: Skips over the line of code that is currently in place and executes it without calling any functions.
Visual Studio Keyboard Shortcut - F7
  • Shift+F7: Enters the current line of code and any functions it calls to see a detailed explanation of how they are being executed.
Visual Studio Keyboard Shortcut - Shift+F7

F6 / Shift-F6 / Ctrl-Shift-B

  • F6: Moves your cursor fast to the next file by navigating among open document tabs.
  • Shift-F6: This key allows you to quickly return to the previous file by navigating backward via open document tabs.
  • Ctrl-Shift-B: This opens the list of open documents, making it easy to choose and navigate to a particular document from a detailed overview.
Visual Studio Keyboard Shortcut - F6 / Shift-F6 / Ctrl-Shift-B

Ctrl-Shift-A & Alt-Shift-A

  • Ctrl+Shift+A: Simplifies project organization by quickly adding a new item, such as a class, file, or folder, to your active project.
Visual Studio Keyboard Shortcut - Ctrl+Shift+A
  • Alt+Shift+A: This shortcut allows you to easily add an existing item to your current project, such as a source code file or resource, which makes code reuse and integration easier.
Visual Studio Keyboard Shortcut - Alt+Shift+A:

Ctrl-K + Ctrl-C & Ctrl-K + Ctrl-U

  • Ctrl+K+C: For testing or organizing purposes, comment out the chosen lines of code, temporarily disabling them without removing them.
  • Ctrl+K+U: Reactivates commented-out code lines so that they can be executed again.
Visual Studio Keyboard Shortcut - Ctrl-K + Ctrl-C & Ctrl-K + Ctrl-U

Ctrl-M + Ctrl-O & Ctrl-M + Ctrl-P

  • Ctrl+M+O: Provides a high-level overview of the current document by reducing code blocks and functions to display only their headers.
Visual Studio Keyboard Shortcut - Ctrl+M+O:
  • Ctrl+M+P: Expands the current document by bringing together code blocks and functions that had previously been compacted to display their whole contents.
Visual Studio Keyboard Shortcut - Ctrl+M+P

Ctrl-K + Ctrl-S & Alt-Shift-Arrow(Right,Left,Bottom,Top)

  • Ctrl+K+S: Surrounds the selected code with a control flow statement (like if, for, while, etc.), saving time and effort in block creation.
  • Alt-Shift-Arrow: Copies and pastes the selected code vertically or horizontally, depending on the arrow direction:
    • Right: Copies to the right of the cursor.
    • Left: Copies to the left of the cursor.
    • Down: Copies below the current line.
    • Up: Copies above the current line.
Visual Studio Keyboard Shortcut - Ctrl-K + Ctrl-S & Alt-Shift-Arrow(Right,Left,Bottom,Top) Visual Studio Keyboard Shortcut - Ctrl-K + Ctrl-S & Alt-Shift-Arrow(Right,Left,Bottom,Top) Visual Studio Keyboard Shortcut - Ctrl-K + Ctrl-S & Alt-Shift-Arrow(Right,Left,Bottom,Top) Visual Studio Keyboard Shortcut - Ctrl-K + Ctrl-S & Alt-Shift-Arrow(Right,Left,Bottom,Top) Visual Studio Keyboard Shortcut - Ctrl-K + Ctrl-S & Alt-Shift-Arrow(Right,Left,Bottom,Top)Visual Studio Keyboard Shortcut - Ctrl-K + Ctrl-S & Alt-Shift-Arrow(Right,Left,Bottom,Top)

Ctrl-(+) + Ctrl-. & F12

  • Ctrl-(+)+ Ctrl-.: This keyboard shortcut is used for quick fixes and code suggestions in Visual Studio. It brings up the "lightbulb" menu, offering suggestions for changes to the code or solutions to fix problems and enhance its quality.
Visual Studio Keyboard Shortcut - Ctrl-(+)+ Ctrl-.
  • F12: In Visual Studio, F12 is the "Go to Definition" shortcut. Developers can examine and comprehend the source code for a particular element by hitting F12 to browse to the definition of a symbol that has a red line below it.
Visual Studio Keyboard Shortcut - F12

Ctrl-Shift-F, Ctrl-F & Ctrl-H

  • Ctrl-Shift-F: Using the Ctrl-Shift-F keyboard shortcut, you can search for specific text throughout your project by using the Find in Files dialogue box.
Visual Studio Keyboard Shortcut - Ctrl-Shift-F Visual Studio Keyboard Shortcut - Ctrl-Shift-F
  • Ctrl-F: Using the keyboard shortcut Ctrl-F, you can search for and replace text in the current document.
  • Ctrl-H: Similarly launches the Find and Replace dialogue box, but for fast bulk replacements, the Replace All option is already chosen.
Visual Studio Keyboard Shortcut - Ctrl-F & Ctrl-H

F4 & Ctrl-Alt-L

  • F4: When you press this key in Visual Studio, the "Properties" box opens, giving you an easy method to inspect and modify the properties of the project item that you have selected, like a form or a control.
Visual Studio Keyboard Shortcut - F4
  • Ctrl-Alt-L: A hierarchical view of the files and projects in the current solution is available in Visual Studio through the "Solution Explorer" window, which is opened by pressing Ctrl-Alt-L.
Visual Studio Keyboard Shortcut - Ctrl-Alt-L
Summary

Once you know these ten Visual Studio keyboard shortcuts, you can be extremely productive. They optimise your workflow for building and debugging (F5 & Ctrl+F5), code modification (Ctrl+K+C/U, Alt-Shift-Arrow), navigation (F6/Shift+F6, Ctrl-Shift-B), and more. Additionally, you can effectively use search tools (Ctrl-Shift-F, Ctrl-F/H) and code insights (Ctrl-(+/.), F12). Remember the power of Ctrl-Alt-L for project exploration and F4 for properties. Take control of Visual Studio with these essential keys! 

FAQs

Using Ctrl+L, you can align a selected word or line to the left of the screen. Use Ctrl+M to indent the sentence. Using Ctrl+N, a new, blank document window opens. To select a file to open, press Ctrl+O to open the dialogue box or page.

On a computer keyboard, the function keys F1 through F12 can carry out different functions based on the operating system, software, or application being utilized. 

To execute the program without debugging, press CTRL + F5. Try F5 if it's not functioning. Try simply resetting the keyboard choices in Tools > Options > Environment > Keyboard if F5 is not responding. Click the Reset button on the dialogue window.
Share Article
About Author
Shailendra Chauhan (Microsoft MVP, Founder & CEO at Scholarhat by DotNetTricks)

Shailendra Chauhan, Founder and CEO of ScholarHat by DotNetTricks, is a renowned expert in System Design, Software Architecture, Azure Cloud, .NET, Angular, React, Node.js, Microservices, DevOps, and Cross-Platform Mobile App Development. His skill set extends into emerging fields like Data Science, Python, Azure AI/ML, and Generative AI, making him a well-rounded expert who bridges traditional development frameworks with cutting-edge advancements. Recognized as a Microsoft Most Valuable Professional (MVP) for an impressive 9 consecutive years (2016–2024), he has consistently demonstrated excellence in delivering impactful solutions and inspiring learners.

Shailendra’s unique, hands-on training programs and bestselling books have empowered thousands of professionals to excel in their careers and crack tough interviews. A visionary leader, he continues to revolutionize technology education with his innovative approach.
Accept cookies & close this