Thursday, August 14, 2008

Visual Studio 2008 Hotkeys (Tip)

Concluding the Keyboard Shortcuts posted here before.
  1. Reformat Code: CTL-K, CTL-D reformats code
  2. Collapse Code Sections: CTL-M, CTL-O
  3. Surrond selection with...: CTL-K, CTL-S (helpful in creating code regions)

Edit

Edit.CollapseTo-Definitions CTRL + M, O
Edit.ToggleAllOutlining CTRL + M, L
Edit.ToggleOutliningExpansion CTRL + M, M
Edit.StopOutlining CTRL + M, P
Edit.CommentSelection CTRL + K, C or CTRL + E, C
Edit.UncommentSelection CTRL + K, U or CTRL + E, U
Edit.FormatDocument CTRL + K, D or CTRL + E, D
Edit.FormatSelection CTRL + K, F or CTRL + E, F
Edit.InsertSnippet CTRL + K, X
Edit.SurroundWith CTRL + K, S
Edit.InvokeSnippetFromShortcut TAB
Edit.CycleClipboardRing CTRL + SHIFT + V
Edit.Replace CTRL + H
Edit.ReplaceInFiles CTRL + SHIFT + H
View.ShowSmartTag CTRL + . Or SHIFT + ALT + F10
File
File.NewProject CTRL + SHIFT + N
File.OpenProject CTRL + SHIFT + O
Project.AddClass SHIFT + ALT + C
Project.AddExistingItem SHIFT + ALT + A
Project.AddNewItem CTRL + SHIFT + A
Window.ShowEzMDIFileList CTRL + ALT + DOWN ARROW
Edit.OpenFile CTRL + O
Intellisense
Edit.CompleteWord CTRL + SPACE or CTRL + K, W
Edit.ListMembers CTRL + J or CTRL + K, L
Edit.QuickInfo CTRL + K, I
Edit.ParameterInfo CTRL + SHIFT + SPACE or CTRL K, P
Make Completion List Transparent CTRL
Navigation
Edit.FindAllReferences SHIFT + F12 or CTRL + K, R
Edit.GoToBrace CTRL + ]
Edit.GoToDefinition F12
Edit.GoToNextLocation F8
Edit.IncrementalSearch CTRL + I
View.ClassViewGo-ToSearch, Combo CTRL + K, CTRL + V
View.ForwardBrowseContext CTRL + SHIFT + 7
View.PopBrowseContext CTRL + SHIFT + 8
View.NavigateBackward CTRL + MINUS SIGN (-)
View.NavigateForward CTRL + SHIFT + MINUS SIGN (-)
Edit.FindInFiles CTRL + SHIFT + F
Edit.FindSymbol ALT + F12
View.ViewCode F7
View.ViewDesigner SHIFT + F7
View.ViewMarkup SHIFT + F7
Window.MoveToNavigationBar CTRL + F2
Edit.Find CTRL + F
Edit.GoTo CTRL + G
Edit.GoToFindCombo CTRL + /
Window
View.ClassView CTRL + W, C
View.CodeDefinitionWindow CTRL + W, D
View.Command-Window CTRL + W, A
View.ErrorList CTRL + W, E
View.ObjectBrowser CTRL + W, J
View.Output CTRL + W, O
View.PropertiesWindow CTRL + W, P
View.SolutionExplorer CTRL + W, S
View.TaskList CTRL + W, T
View.Toolbox CTRL + W, X
View.ServerExplorer CTRL + W, L
Window.CloseToolWindow SHIFT + ESC
Data.ShowDataSources SHIFT + ALT + D
Window.CloseDocument, Window CTRL + F4
Window.NextDocument, WindowNav CTRL + TAB
Refactor
Refactor.EncapsulateField CTRL + R, E
Refactor.ExtractInterface CTRL + R, I
Refactor.ExtractMethod CTRL + R, M
Refactor.PromoteLocalVariabletoParameter CTRL + R, P
Refactor.RemoveParameters CTRL + R, V
Refactor.Rename CTRL + R, R or F2
Refactor.ReorderParameters CTRL + R, O
Debugging
Debug.Autos CTRL + D, A
Debug.CallStack CTRL + D, C
Debug.Immediate CTRL + D, I
Debug.Locals CTRL + D, L
Debug.QuickWatch CTRL + D, Q
Debug.Start F5
Debug.StartWithoutDebugging CTRL + F5
Debug.StepInto F11
Debug.StepOut SHIFT + F11
Debug.StepOver F10
Debug.StopDebugging SHIFT + F5
Debug.ToggleBreakpoint F9
Debug.Watch CTRL + D, W
Debug.EnableBreakpoint CTRL + F9
Make Datatip Transparent [CTRL]
Build
Build.BuildSolution F6 or CTRL + SHIFT + B
Build.BuildSelection SHIFT + F6

Thursday, June 19, 2008

Setting or reordering the Tab Order in Visual Studio 2008 (Tip)

Within Visual Studio 2008 (while a form or user control is opened in the designer mode) select the Tab Order button on the layout toolbar as shown in the image.

This will add a number withing a small rectangle to each control in the form. Start clicking on each number and it will start reordering the tabs starting with zero. When done, hit Esc.




Thursday, May 15, 2008

Keyboard Shortcuts (Visual Studio) (Tip)

Visual Studio Keyboard Shortcuts

  • Control + '.'It is a shortcut for Control + Shift + F10 that opens the smart tage window and lets you add Using statement.
  • Control + Alt + 'Q' or Shift + F9: It will open the Quick watch window while you are debuging.
  • Control + Alt + Down: Shows dropdown of currently open files. Type the first few letters of the file you want to select.
  • Control + Alt + 'L': Shows Solution Explorer.
  • Control + '\' + 'E': Shows error list.
  • Control + Alt + 'O': Shows output pane.
  • Alt + ENTER: It will open up the Properties window.
  • Control + 'K' + 'S': It opens up the code snippets dialogue within the code. You can try this shortcut with some code selected and it will surround the selected code, with the chosen code snippet. Look at my other post for usage of code snippet.
  • Control + 'K' + 'C' and Control + 'K' + 'U': They are for commenting selected text (the 'c' options) and uncommenting selected text (the 'u' option).
  • Control + 'K' + 'F' and CRTL + 'K' + 'D': They will format the code in the window to be nicely indented. using 'd' will format all the document while using 'f' will format only selected text. The formatting is for all types of documents, HTML, Xaml, XML, C#… This one is my favorite.
  • Control + 'M' + 'O': Collapse to Definitions.
  • F4: Shows propoerites of the selected item.
  • F7: Toggle between Designer and Source views.
  • F9: It will add a breakpoint to the code line your marker is currently at. Clicking F9 again will remove this breakpoint from that line.
  • F10: Debug - step over.
  • Control + F10: Debug - Run to cursor.
  • F11: Debug - step into.
  • Shift + F11: Debug - step out.
  • F12: This one if for the “Go to definition” command which will take you to the definition of the object your marker is currently on.
  • Shift + F12: Find all references of a function or variable.
  • Shift + Del: It will cut the entire row from the document and past it to the clipboard. No need to select the row, just put the marker there and click Shift + Del and it is gone.
  • Control + C: Yeah, this is the standard shortcut of Windows. But, with Visual Studio, it will copy the line without even selecting it!
  • Control + Alt + 'E': It will open the Exceptions window, which allows you to tell Visual Studio to halt at specific exceptions, halt on all exceptions or selecet some exceptions to ignore.

Please post more, I will try and keep the list updated. Thanks.

Organize "using" statements (Visual Studio) (Tip)


This is very helpful feature of Visual studio 2008. Normaly, we tend to forget to remove unused "using" statements or if there too many, it's difficult to find out which one to remove. So, we rather keep them untouched.
Now, Visual Stuiod 2008 helps you organizing those. Just right click on the code and select "Organize Usings" menu. It gives you these thress choices:
Remove Unused Usings
Sort Usings
Remove and Sort
Happy coding!

Usage of code snippets (Visual Studio) (Tip)

With Visual Studio 2008, you can write fastest code ever!To use the code snippets, type-in code snippets (e.g. "for") shortcut, hit Tab twice, viola! The code will be added automatically. Code snippets can be reviewed or added. Look at the video for the details. Try and watch video in the full screen if you can. Don't know how well, will it be watchable.

This is what I use in the demo below:

class -> Tab -> Tab
ctor -> Tab -> Tab
tryf -> Tab -> Tab
for -> Tab -> Tab
cw -> Tab -> Tab
exception -> Tab -> Tab