Visual Studio Shortcut Keys
Visual Studio Shortcut Keys
You are familiar with many of Visual Studio's shortcut keys, but not all of them. Here is a handy reference that can make your .NET lifestyle easier and a lot more producti e. Note! the 'must" know' shortcut keys are highlighted.
General
Shortcut Ctrl-X or Shift-Delete Ctrl-C or Ctrl-Insert Ctrl-V or Shift-Insert Ctrl-Z or Alt-Backspace Ctrl-Y or Ctrl-Shift-Z Ctrl-Shift-V or Ctrl-Shift-Insert $astes an item from the clipboard rin& tab of the Toolbo( at the cursor in the file and automatically selects the pasted item. #ycle throu&h the items on the clipboard by pressin& the shortcut keys repeatedly Esc #loses a menu or dialo&, cancels an operation in pro&ress, or places focus in the current document window Ctrl-S Sa es the selected files in the current pro)ect *usually the file that is bein& edited+ Ctrl-Shift-S Ctrl!" Shift-!" !# Sa es all documents and pro)ects ,isplays the $rint dialo& Switches from the desi&n iew to the code iew in the editor Switches from the code iew to the desi&n iew in the editor -o es the cursor to the ne(t item, for e(ample in the Task.ist window or /ind 'esults window 'edo the pre ious undo action %ndo pre ious editin& action $astes the item in the clipboard at the cursor #opies the currently selected item to the clipboard Description #uts the currently selected item to the clipboard
Shift-!#
-o es the cursor to the pre ious item, for e(ample in the Task.ist window or /ind 'esults window
/inds a reference to the selected item or the item under the cursor 0pens the file whose name is under the cursor or is currently selected Switches focus to the /ind1#ommand bo( on the Standard toolbar -o es to the ne(t task in the Task.ist window -o es backward in the browse history. 2 ailable in the ob)ect browser or #lass View window
3o back in the web browser history 3o forward in the web browser history
+e,t na-igation
Shortcut (eft Arro) *ight Arro) Do)n Arro) .p Arro) age Do)n age .p End /o0e Description -o es the cursor one character to the left -o es the cursor one character to the ri&ht -o es the cursor down one line -o es the cursor up one line Scrolls down one screen in the editor window Scrolls up one screen in the editor window -o es the cursor to the end of the current line -o es the cursor to the be&innin& of the line. 4f you press Home when the cursor is already at the start of the line, it will to&&le the cursor between the first non"whitespace character and the real start of the line Ctrl-End Ctrl-/o0e Ctrl-& -o es the cursor to the end of the document -o es the cursor to the start of the document ,isplays the 3o to .ine dialo&. 4f the debu&&er is runnin&, the dialo& also lets you specify addresses or function names to &o to Ctrl-1 -o es the cursor to the matchin& brace in the document. 4f the cursor is on an openin& brace, this will mo e to the correspondin& closin& brace and ice ersa Ctrl-23 Ctrl-4 -o es to the ne(t bookmark in the document
-o es to the pre ious bookmark ,isplays 5uick 4nfo, based on the current lan&ua&e Scrolls te(t down one line but does not mo e the cursor. This is useful for scrollin& more te(t into iew without losin& your place. 2 ailable only in te(t editors
Ctrl-.p Arro)
Scrolls te(t up one line but does not mo e the cursor. 2 ailable only in te(t editors
-o es the cursor one word to the ri&ht -o es the cursor one word to the left Na i&ates to the ne(t definition, declaration, or reference of an item. 2 ailable in the ob)ect browser and #lass View window. 2lso a ailable in source editin& windows if you ha e already used the Edit.3oTo'eference *Shift"/67+ shortcut
Ctrl-Shift-%
+e,t 0anipulation
Shortcut Enter Delete Insert +a5 Description 4nserts a new line ,eletes one character to the ri&ht of the cursor To&&les between insert and o ertype insertion modes 4ndents the currently selected line or lines by one tab stop. 4f there is no selection, this inserts a tab stop Shift-+a5 Backspace or Shift-Backspace Ctrl-23 Ctrl-C -arks the current line or selected lines of code as a comment, usin& the correct comment synta( for the pro&rammin& lan&ua&e Ctrl-23 Ctrl-. 'emo es the comment synta( from the current line or currently selected lines of code Ctrl-+ or Shift-Enter Swaps the characters on either side of the cursor. */or e(ample, 2#89, becomes 298#,.+ 2 ailable only in te(t editors -o es current line or selected lines one tab stop to the left ,eletes one character to the left of the cursor
'emo es all unnamed bookmarks in the current document 2utomatically determines lo&ical boundaries for creatin& re&ions in code, such as procedures, and then hides them. This collapses all such re&ions in the current document
,isplays statement completion based on the current lan&ua&e or autocompletes word if e(istin& te(t unambi&uously identifies a sin&le symbol
Ctrl-23 Ctrl-8
'emo es hori:ontal whitespace in the selection or deletes whitespace ad)acent to the cursor if there is no selection
Ctrl-23 Ctrl-!
2pplies the indentin& and space formattin& for the lan&ua&e as specified on the /ormattin& pane of the lan&ua&e in the Te(t Editor section of the 0ptions dialo& to the selected te(t.
Ctrl-(
#uts all selected lines or the current line if nothin& has been selected to the clipboard
Ctrl-Shift-(
,eletes all selected lines or the current line if no selection has been made
4nserts a blank line abo e the cursor 4nserts a blank line below the cursor -o es the line containin& the cursor below the ne(t line .ists members for statement completion when editin& code #han&es the selected te(t to lowercase characters #han&es the selected te(t to uppercase characters ,isplays a tooltip that contains information for the current parameter, based on the current lan&ua&e
'emo es the outlinin& information for the currently selected re&ion 'emo es all outlinin& information from the entire document Swaps the anchor and endpoint of the current selection To&&les all pre iously marked hidden te(t sections between hidden and display states
Sets or remo es a bookmark at the current line To&&les the currently selected hidden te(t section or the section containin& the cursor if there is no selection between the hidden and
display states Ctrl-23 Ctrl-/ Ctrl-*3 Ctrl-* Ctrl-*3 Ctrl-: Ctrl-Delete Ctrl-Backspace Ctrl-Shift-+ Sets or remo es a shortcut in the tasklist to the current line Enables or disables word wrap in an editor Shows or hides spaces and tab marks ,eletes the word to the ri&ht of the cursor ,eletes the word to the left of the cursor Transposes the two words that follow the cursor. */or e(ample, 8End Sub would be chan&ed to read Sub End8.+
+e,t selection
Shortcut Shift-(eft Arro) Shift-Alt-(eft Arro) Description -o es the cursor to the left one character, e(tendin& the selection -o es the cursor to the left one character, e(tendin& the column selection Shift-*ight Arro) -o es the cursor to the ri&ht one character, e(tendin& the selection
Shift-Alt-*ight Arro) -o es the cursor to the ri&ht one character, e(tendin& the column selection Ctrl-Shift-End Ctrl-Shift-/o0e Ctrl-Shift-1 Shift-Do)n Arro) -o es the cursor to the end of the document, e(tendin& the selection -o es the cursor to the start of the document, e(tendin& the selection -o es the cursor to the ne(t brace, e(tendin& the selection -o es the cursor down one line, e(tendin& the selection
Shift-Alt-Do)n Arro) -o es the cursor down one line, e(tendin& the column selection Shift-End Shift-Alt-End Shift-/o0e Shift-Alt-/o0e Shift-.p Arro) Shift-Alt-.p Arro) Shift- age Do)n Shift- age .p -o es the cursor to the end of the current line, e(tendin& the selection -o es the cursor to the end of the line, e(tendin& the column selection -o es the cursor to the start of the line, e(tendin& the selection -o es the cursor to the start of the line, e(tendin& the column selection -o es the cursor up one line, e(tendin& the selection -o es the cursor up one line, e(tendin& the column selection E(tends selection down one pa&e E(tends selection up one pa&e
Ctrl-A Ctrl-:
Selects e erythin& in the current document Selects the word containin& the cursor or the word to the ri&ht of the cursor
Ctrl-;
Selects from the current location in the editor back to the pre ious location in the na i&ation history
Ctrl-Shift- age Do)n -o es the cursor to the last line in iew, e(tendin& the selection Ctrl-Shift- age .p -o es the cursor to the top of the current window, e(tendin& the selection Ctrl-Shift-Alt-*ight Arro) Ctrl-Shift-(eft Arro) Ctrl-Shift-Alt-(eft Arro) -o es the cursor one word to the left, e(tendin& the selection -o es the cursor to the left one word, e(tendin& the column selection -o es the cursor to the ri&ht one word, e(tendin& the column selection
ro<ect related
Shortcut Ctrl-Shift-B Ctrl-4 Description 9uilds the solution ,isplays the New /ile dialo&. Note! files created this way are not associated with a pro)ect. %se #trl"Shift"2 to add a new file in a pro)ect Ctrl-Shift-4 Ctrl-7 Ctrl-Shift-7 Shift-Alt-A Ctrl-Shift-A Ctrl-Alt-Insert ,isplays the New $ro)ect dialo& ,isplays the 0pen /ile dialo& ,isplays the 0pen $ro)ect dialo& ,isplays the 2dd E(istin& 4tem dialo& ,isplays the 2dd New 4tem dialo& 2llows you to o erride base class methods in a deri ed class when an o erridable method is hi&hli&hted in the #lass View pane
:indo) 0anipulation
Shortcut Shift-Alt-Enter Ctrl-= Description To&&les full screen mode 3oes back to the pre ious location in the na i&ation history. */or
e(ample, if you press #trl"Home to &o to the start of a document, this shortcut will take the cursor back to where er it was before you pressed #trl"Home.+ Ctrl-Shift-= -o es forward in the na i&ation history. This is effecti ely an undo for the View.Na i&ate9ackward operation Ctrl-!> Shift-Esc Ctrl-!% Ctrl-+a5 Ctrl-!?3 Ctrl-Shift-+a5 Alt-!?3 Ctrl-Shift-!? Shift-Alt-!? !? Shift-!? Ctrl- agedo)n -o es to the pre iously selected window -o es to the ne(t pane of a split pane iew of a sin&le document -o es to the pre ious pane of a document in split pane iew -o es to the ne(t tab in the document or window *e.&., you can use this to switch the HT-. editor from its desi&n iew to its HT-. iew Ctrl- age.p -o es to the pre ious tab in the document or window -o es to the ne(t tool window #loses the current -,4 child window #loses the current tool window -o es the cursor to the na i&ation bar at the top of a code iew #ycles throu&h the -,4 child windows one window at a time -o es to the pre ious -,4 child window
surface Ctrl-.p Arro) .p Arro) +a5 Shift-+a5 -o es the control up in increments of one on the desi&n surface -o es the control up into the ne(t &rid position on the desi&n surface -o es to the ne(t control in the tab order -o es to the pre ious control in the tab order
Ctrl-Shift-Do)n Arro) 4ncreases the hei&ht of the control in increments of one on the desi&n surface Shift-Do)n Arro) 4ncreases the hei&ht of the control to the ne(t &rid position on the desi&n surface Ctrl-Shift-(eft Arro) 'educes the width of the control in increments of one on the desi&n surface Shift-(eft Arro) 'educes the width of the control to the ne(t &rid position on the desi&n surface Ctrl-Shift-*ight Arro) 4ncreases the width of the control in increments of one on the desi&n surface Shift-(eft Arro) 4ncreases the width of the control to the ne(t &rid position on the desi&n surface Ctrl-Shift-.p Arro) ,ecreases the hei&ht of the control in increments of one on the desi&n surface Shift-.p Arro) ,ecreases the hei&ht of the control to the ne(t &rid position on the desi&n surface
under the cursor Ctrl-D Alt-!B3 / Ctrl-I $laces the cursor in the /ind1#ommand line on the Standard toolbar Selects or clears the Search Hidden Te(t option for the /ind dialo& Starts an incremental search;after pressin& #trl"4, you can type in te(t, and for each letter you type, VS.NET will find the first occurrence of the se<uence of letters you ha e typed so far. This is a ery con enient facility, as it lets you find te(t by typin& in e(actly as many characters as are re<uired to locate the te(t and no more. 4f you press #trl"4 a second time without typin& any characters, it recalls the pre ious pattern. 4f you press it a third time or you press it when an incremental search has already found a match, VS.NET searches for the ne(t occurrence. Alt-!B3 C Alt-!B3 * Selects or clears the -atch #ase option for /ind and 'eplace operations Selects or clears the 'e&ular E(pression option so that special characters can be used in /ind and 'eplace operations Ctrl-/ Ctrl-Shift-/ Ctrl-Shift-I Alt-!B3 S Alt-!B3 B Alt-!B3 : ,isplays the 'eplace dialo& ,isplays the 'eplace in /iles dialo& $erforms an incremental search in re erse direction Halts the current /ind in /iles operation Selects or clears the Search %p option for /ind and 'eplace operations Selects or clears the -atch =hole =ord option for /ind and 'eplace operations Alt-!B3 Selects or clears the =ildcard option for /ind and 'eplace operations
/elp
Shortcut Ctrl-Alt-!$ Ctrl-!$ Description ,isplays the #ontents window for the documentation ,isplays the ,ynamic Help window, which displays different topics dependin& on what items currently ha e focus. 4f the focus is in a source window, the ,ynamic Help window will display help topics that are rele ant to the te(t under the cursor !$ ,isplays a topic from Help that corresponds to the part of the user
interface that currently has the focus. 4f the focus is in a source window, Help will try to display a topic rele ant to the te(t under the cursor Ctrl-Alt-!% Shift-Alt-!% ,isplays the Help 4nde( window ,isplays the 4nde( 'esults window, which lists the topics that contain the keyword selected in the 4nde( window Alt-Do)n Arro) ,isplays the ne(t topic in the table of contents. 2 ailable only in the Help browser window Alt-.p Arro) ,isplays the pre ious topic in the table of contents. 2 ailable only in the Help browser window Ctrl-Alt-!B ,isplays the Search window, which allows you to search for words or phrases in the documentation Shift-Alt-!B ,isplays the Search 'esults window, which displays a list of topics that contain the strin& searched for from the Search window. Shift-!$ ,isplays a topic from Help that corresponds to the user interface item that has the focus
De5ugging
Shortcut Ctrl-Alt-V3 A Description ,isplays the 2uto window to iew the alues of ariables currently in the scope of the current line of e(ecution within the current procedure Ctrl-Alt-Break Temporarily stops e(ecution of all processes in a debu&&in& session. 2 ailable only in run mode Ctrl-Alt-B ,isplays the 9reakpoints dialo&, where you can add and modify breakpoints Ctrl-Alt-C ,isplays the #all Stack window to display a list of all acti e procedures or stack frames for the current thread of e(ecution. 2 ailable only in break mode Ctrl-Shift-!C Ctrl-Alt-D Ctrl-!C #lears all of the breakpoints in the pro)ect ,isplays the ,isassembly window Enables or disables the breakpoint on the current line of code. The line must already ha e a breakpoint for this to work
Ctrl-Alt-E Ctrl-Alt-I
,isplays the E(ceptions dialo& ,isplays the 4mmediate window, where you can e aluate e(pressions and e(ecute indi idual commands
Ctrl-Alt-V3 (
,isplays the .ocals window to iew the ariables and their alues for the currently selected procedure in the stack frame
Ctrl-Alt-63 $
,isplays the -emory 6 window to iew memory in the process bein& debu&&ed. This is particularly useful when you do not ha e debu&&in& symbols a ailable for the code you are lookin& at. 4t is also helpful for lookin& at lar&e buffers, strin&s, and other data that does not display clearly in the =atch or Variables window
,isplays the -emory 7 window ,isplays the -emory > window ,isplays the -emory ? window ,isplays the -odules window, which allows you to iew the .dll or .e(e files loaded by the pro&ram. 4n multiprocess debu&&in&, you can ri&ht" click and select Show -odules for all pro&rams
Ctrl-B Ctrl-Alt-D
0pens the New 9reakpoint dialo& ,isplays the 5uick =atch dialo& with the current alue of the selected e(pression. 2 ailable only in break mode. %se this command to check the current alue of a ariable, property, or other e(pression for which you ha e not defined a watch e(pression
Ctrl-Alt-& Ctrl-Shift-!E
,isplays the 'e&isters window, which displays #$% re&ister contents Terminates the current debu&&in& session, rebuilds if necessary, and then starts a new debu&&in& session. 2 ailable in break and run modes
Ctrl-Alt-4
,isplays the 'unnin& ,ocuments window that displays the set of HT-. documents that you are in the process of debu&&in&. 2 ailable in break and run modes
Ctrl-!$F
Starts or resumes e(ecution of your code and then halts e(ecution when it reaches the selected statement. This starts the debu&&er if it is not already runnin&
Ctrl-Shift-!$F Alt-4.6 G
Sets the e(ecution point to the line of code you choose Hi&hli&hts the ne(t statement to be e(ecuted
!E
4f not currently debu&&in&, this runs the startup pro)ect or pro)ects and attaches the debu&&er. 4f in break mode, this allows e(ecution to continue *i.e., it returns to run mode+.
Ctrl-!E
'uns the code without in okin& the debu&&er. /or console applications, this also arran&es for the console window to stay open with a @$ress any key to continue@ prompt when the pro&ram finishes
!$$
E(ecutes code one statement at a time, tracin& e(ecution into function calls
Shift-!$$
E(ecutes the remainin& lines of a function in which the current e(ecution point lies
E(ecutes the ne(t line of code but does not step into any function calls 2 ailable in break and run modes, this terminates the debu&&in& session ,isplays the This window, which allows you to iew the data members of the ob)ect associated with the current method
Ctrl-Alt-/
,isplays the Threads window to iew all of the threads for the current process
!C Ctrl-!$$
Sets or remo es a breakpoint at the current line ,isplays the disassembly information for the current source file. 2 ailable only in break mode
Ctrl-Alt-:3 $
,isplays the =atch 6 window to iew the alues of ariables or watch e(pressions
,isplays the =atch 7 window ,isplays the =atch > window ,isplays the =atch ? window ,isplays the $rocesses dialo&, which allows you to attach or detach the debu&&er to one or more runnin& processes
75<ect 5ro)ser
Shortcut Alt-!$% Ctrl-!$% Description ,isplays the /ind Symbol dialo& ,isplays the declaration of the selected symbol in the code
,isplays the definition for the selected symbol in code ,isplays the /ind Symbol 'esults window ,isplays the 0b)ect 9rowser to iew the classes, properties, methods, e ents, and constants defined either in your pro)ect or by components and type libraries referenced by your pro)ect
Alt-=
-o es back to the pre iously selected ob)ect in the selection history of the ob)ect browser
Shift-Alt-=
-o es forward to the ne(t ob)ect in the selection history of the ob)ect browser
+ool )indo)
Shortcut Ctrl-Shift-6 Description To&&les the #ommand window into or out of a mode allowin& te(t within the window to be selected Ctrl-Shift-C Ctrl-Alt-A ,isplays the #lass View window ,isplays the #ommand window, which allows you to type commands that manipulate the 4,E Ctrl-Alt-+ ,isplays the ,ocument 0utline window to iew the flat or hierarchical outline of the current document Ctrl-Alt-! Ctrl-Alt-7 !> ,isplays the /a orites window, which lists shortcuts to web pa&es ,isplays the 0utput window to iew status messa&es at runtime ,isplays the $roperties window, which lists the desi&n"time properties and e ents for the currently selected item Shift-!> ,isplays the property pa&es for the item currently selected. */or e(ample, use this to show a pro)ect's settin&s.+ Ctrl-Shift-E Ctrl-Alt-S ,isplays the 'esource View window ,isplays the Ser er E(plorer window, which allows you to iew and manipulate database ser ers, e ent lo&s, messa&e <ueues, web ser ices, and many other operatin& system ser ices Ctrl-Alt-* ,isplays the web browser window, which allows you to iew pa&es on the 4nternet
Ctrl-Alt-(
,isplays the Solution E(plorer, which lists the pro)ects and files in the current solution
Ctrl-Alt-2
,isplays the Task.ist window, which displays tasks, comments, shortcuts, warnin&s, and error messa&es
Ctrl-Alt-X
,isplays the Toolbo(, which contains controls and other items that can be dra&&ed into editor and desi&ner windows
absolutely positioned elements Ctrl- age Do)n Ctrl-D Switches from desi&n iew to HT-. iew and ice ersa ,isplays a 6"pi(el border around HT-. elements that support a 90',E' attribute and ha e it set to :ero, such as tables, table cells, and di isions
6acro
Shortcut Alt-!# Alt-!$$ Ctrl-Shift-* Description ,isplays the -acro E(plorer window, which lists all a ailable macros .aunches the macros 4,E $laces the en ironment in macro record mode or completes recordin& if already in record mode Ctrl-Shift$lays back a recorded macro