Keyboard Shortcuts: Navigating the IDE by Using the Keyboard

Visual Basic has many keyboard shortcuts that you can use to help you perform tasks in the Integrated Development Environment (IDE) quickly. The following tables describe some of these keyboard shortcuts, and give the command name equivalents in parenthesis.

You can download a poster that contains all the default keybindings (grouped by task) for Visual Basic on the Microsoft Download Center.

Title

Shortcut

Description

Toggle All Outlining

CTRL +M, CTRL + L

Toggles all existing regions between collapsed and expanded states. (Edit.ToggleAllOutlining)

Toggle Outlining for Current Region

CTRL + M, CTRL + M

Toggles the current region between collapsed and expanded states. (Edit.ToggleOutliningExpansion)

Comment and Uncomment

CTRL + K, CTRL + C

CTRL + K, CTRL + U

Inserts and removes, respectively, the apostrophe (') at the start of the current line or every selected line. (Edit.CommentSelection and Edit.UncommentSelection)

Undo

CTRL + Z

Undoes the last action. (Edit.Undo)

Redo

CTRL + SHIFT + Z

Redoes the last action. (Edit.Redo)

Cut Line

CTRL + Y

Cuts the current line of code. (Edit.LineCut)

Insert Blank Line

CTRL + ENTER

CTRL + SHIFT + ENTER

Inserts a blank line above or below the cursor position, respectively. (Edit.LineOpenAbove and Edit.LineOpenBelow)

Select Word

CTRL + SHIFT + W

Selects the word that contains, or is to the right of, the cursor. (Edit.SelectCurrentWord)

Delete Word

CTRL + BACKSPACE

CTRL + DELETE

Deletes to the start and end of the word, respectively.

(Edit.WordDeleteToStart and Edit. WordDeleteToEnd)

Change Casing

CTRL + U

CTRL + SHIFT + U

Changes the selected text to lowercase or uppercase characters, respectively. (Edit.MakeLowercase and Edit.MakeUppercase)

Replace

CTRL + H

CTRL + SHIFT H

Displays the Quick Replace tab or the Replace In Files tab, respectively, of the Find and Replace dialog box. (Edit.Replace and Edit.ReplaceInFiles)

Extend Selection

SHIFT + ALT + UP ARROW

SHIFT + ALT + DOWN ARROW

Moves the cursor one line up or down respectively, extending the line selection. (Edit.LineUpExtendColumn and Edit.LineDownExtendColumn)

Format Code

CTRL + K, CTRL + D

CTRL + K, CTRL + F

Formats the current document or selection, respectively. (Edit. FormatDocument and Edit.FormatSelection)

Display Smart Tag

CTRL + DOT (.)

SHIFT + ALT + F10

Displays the available options on the Smart Tag menu. (View. ShowSmartTag)

Help

F1

Displays a topic from Help that corresponds to the current user interface element or to the code item or error messages selected. (Help.F1Help)

Title

Shortcut

Description

Build Solution

CTRL + SHFT + B

Builds all the projects in the solution. (Build.BuildSolution)

Start Debugging

F5

Starts the application in the debugger. When in Break mode, invoking this command runs the application until the next breakpoint. (Debug.Start)

Start Without Debugging

CTRL + F5

Starts the application without invoking the debugger. Use this exclusively instead of F5 for Web site debugging. (Debug.StartWithoutDebugging)

Step Into

F8 or F11

Executes code one statement at a time, following execution into method calls. (Debug.StepInto)

Step Out

CTRL + SHIFT + F8

SHIFT + F11

Executes the remaining lines of the method in which the current execution point is located. (Debug.StepOut)

Step Over

SHIFT + F8

F10

Executes the next line of code, but does not follow execution into any method calls. (Debug.StepOver)

Stop Debugging

CTRL + ALT + BREAK

Stops running the current application in the debugger. (Debug.StopDebugging)

Toggle Breakpoint

F9

Sets or removes a breakpoint at the current line. (Debug.ToggleBreakpoint)

Set Next Statement

CTRL + F9

Sets the execution point to the line of code you choose. (Debug.SetNextStatement)

Break at a Function

CTRL + B

Displays the New Breakpoint window. (Debug.BreakatFunction)

Attach to Process

CTRL + ALT + P

Displays the Attach to Process dialog box. (Tools.AttachToProcess)

Make Data Tip Transparent

CTRL

Hides the current data tip so that you can see the code underneath it. Must be invoked while a data tip is active.

Immediate Window

CTRL + G

Displays the Immediate window. (Debug.Immediate)

Call Stack Window

CTRL + L

Displays the Call Stack window. (Debug.CallStack)

QuickWatch Window

SHIFT + F9

Displays the QuickWatch dialog box. (Debug.QuickWatch)

Title

Shortcut

Description

Navigation Bar

CTRL + F2

Moves the cursor to the drop-down list located at the top of the Code Editor. (Window.MoveToNavigationBar)

Object Browser

F2

Displays the Object Browser. (View.ObjectBrowser)

Properties Window

F4

Displays the Properties window for the currently selected item. (View.PropertiesWindow)

Solution Explorer

CTRL + R

Displays Solution Explorer. (View.SolutionExplorer)

Show Data Sources

SHIFT + ALT + D

Displays the Data Sources window. (Data.ShowDataSources)

Toolbox

CTRL + ALT + X

Displays the Toolbox. (View.Toolbox)

Error List

CTRL + \, E

Displays the Error List. (View.ErrorList)

Close Tool Window

SHIFT + ESC

Closes the current tool window. (Window.CloseToolWindow)

Close Document Window

CTRL + F4

Closes the current tab. (Window.CloseDocumentWindow)

Title

Shortcut

Description

Go to Definition

F12

SHIFT + F12

Moves to the declaration for the selected symbol. (Edit.GoToDefinition)

Highlight References

CTRL + SHIFT + UP/DOWN ARROW

Moves to the next or previous reference for the selected symbol, or clause of an If...Then...Else or Select...Case statement. CTRL + SHIFT + DOWN + ARROW moves to the next reference for the selected symbol; CTRL + SHIFT + UP ARROW moves to the previous reference. (Edit.MoveToNextReference, Edit.MoveToPreviousReference)

IDE Navigator

CTRL + TAB

Displays the IDE Navigator, with the first document window selected. The IDE Navigator functions similarly to the Windows Navigator (ALT + SHIFT + TAB), only it is for files and tool windows within Visual Studio. (Window.NextDocumentWindowNav)

View All Open Documents

CTRL + ALT + DOWN ARROW

Displays a pop-up listing of all open documents. (Window.ShowEzMDIFileList)

View Code

F7

Displays the selected item in Code view. (View.ViewCode)

View Designer

SHIFT + F7

Displays the selected item in Design view. (View.ViewDesigner)

Add or Remove Bookmark

CTRL + K, CTRL + K

Sets or removes a bookmark at the current line. (Edit.ToggleBookmark)

Navigate Bookmarks

CTRL + K, CTRL + N

CTRL + K, CTRL + P

Moves to the next or previous bookmark, respectively. (Edit.NextBookmark and Edit. PreviousBookmark)

Delete All Bookmarks

CTRL + K, CTRL + L

Deletes all bookmarks. (Edit.ClearBookmarks)

Title

Shortcut

Description

Find Symbol

ALT + F12

Displays the Find Symbol dialog box. (Edit.FindSymbol)

Find All References

ALT + SHIFT + F12

Displays a list of all references for the symbol selected. (Edit.FindAllReferences)

Find Text

CTRL + F

CTRL + SHIFT + F

Displays the Find and Replace dialog box for a single-file and multiple-file search, respectively. (Edit.Find and Edit.FindInFiles)

Next and Previous Result

F3

SHIFT + F3

Finds the next and previous occurrence, respectively, of the text from the most recent search. (Edit.FindNext and Edit.FindPrevious)

Next and Previous Selected

CTRL + F3

CTRL + SHIFT F3

Finds the next and previous occurrence, respectively, of the currently selected text or the word at the cursor position. (Edit.FindNextSelected and Edit. FindPreviousSelected)

Incremental Search

ALT + I

ALT + SHIFT + I

Activates incremental search (forward and reverse). If no input is typed, the previous search query is used. (Edit.IncrementalSearch and Edit.ReverseIncrementalSearch)

Stop Search

ALT + F3, S

Halts the current Find In Files operation. (Edit.StopSearch)

Title

Shortcut

Description

New Project

CTRL + N

CTRL + SHIFT + N

Displays the New Project dialog box. (File.NewProject)

Open Project

CTRL + O

CTRL + SHIFT + O

Displays the Open Project dialog box. (File.OpenProject)

Add New Item

CTRL + SHIFT + A

Displays the Add New Item dialog box. (Project.AddNewItem)

Add Existing Item

CTRL + D

Displays the Add Existing Item dialog box. (Project.AddExistingItem)

Title

Shortcut

Description

Insert Snippet

Type ? and press TAB

Displays the Code Snippet Picker in the Code Editor. The selected code snippet is then inserted at the cursor position. (Edit.InsertSnippet)

Insert Snippet from Shortcut

Type the snippet shortcut and press TAB

Inserts the expanded code snippet. (Edit.InvokeSnippetFromShortcut)

Insert Property Snippet

Type property and press TAB

Inserts a Property snippet. (Example of Edit.InvokeSnippetFromShortcut)

Insert For Snippet

Type for and press TAB

Inserts a For…Next snippet. (Example of Edit.InvokeSnippetFromShortcut)

List Snippet Shortcuts

Type a snippet shortcut prefix, type ?, and press TAB

Displays the Code Snippet Shortcut Picker. The shortcut in the list, which most closely matches the prefix, is selected.

List Snippet Replacements

CTRL + SPACE

Invokes an IntelliSense completion list for the currently selected snippet replacement.

Escape Replacement Selection

ESC

Deselects the current text. A second ESC deselects the replacement. Can be useful when you want to type at the end of a replacement without extending its bounds.

Title

Shortcut

Description

Display a Filtered List

CTRL + J

Displays the IntelliSense completion list for the current cursor position. (Edit.ListMembers)

Display the Global List or Complete a Word

CTRL + SPACE

If invoked when no list is active, displays the IntelliSense completion list for the current cursor position. If a substring has already been typed and there is a match in the list, completes the word without invoking the list. If invoked when a filtered list is active, switches to the global list. (Edit.CompleteWord)

Common Tab

ALT + COMMA (,)

Decreases the filter level of the active IntelliSense list to the Common tab.

All Tab

ALT + PERIOD (.)

Increases the filter level of the active IntelliSense list to the All tab.

Navigate Up

CTRL + PAGE UP

Navigates to the first item in the IntelliSense completion list.

Navigate Down

CTRL + PAGE DOWN

Navigates to the last item in the IntelliSense completion list.

Commit an Item

TAB

SPACE

ENTER

Inserts the currently selected item in the list. The following characters can also be used to commit: { } ( ) . , : ; + - * / ^ ! = < > \

Escape the List

ESC

Closes the IntelliSense completion list. This can be useful if you want to prevent the currently selected item from being inserted.

In the next set of lessons, you will learn how to write Visual Basic code. These lessons include introductory discussions of variables, arrays, comparisons, and loops.

Next Lesson: Introduction to the Visual Basic Programming Language

Show: