Useful Visual Studio Shortcuts

Last post 09-26-2007, 8:53 AM by tmegz. 14 replies.
Sort Posts: Previous Next
  •  03-28-2007, 8:23 PM

    Useful Visual Studio Shortcuts

    Post here with some XNA fun facts! Like facts that not many people know, or secrets about XNA. Like mine is:

    If you press and hold Ctrl then press "k" and "p," it re-opens the suggestion box. Like if you type:

    Microsoft.Xna.Framework.Graphics( <= after that first parenthesis, a bubble comes up suggesting what to write next. If you accidently exit out of that, you can re-open it by pressing the above keys!

  •  03-29-2007, 9:38 AM

    Re: XNA Fun Facts

    hehe, more like Visual Studio fun facts, but still ... yes, learning the keyboard shortcuts is invaluable :-D 

    my favorite is ctrl+k+d to auto-format your code, or ctrl+shift+b to build your solution, or even the (seemingly) ubiquitous F5 to build, run, and attach debugger ;-)



    Joel Martinez
    Blog: http://codecube.net
    Play Videos on an XNA Texture: Scurvy Media
  •  04-03-2007, 5:06 PM

    Re: XNA Fun Facts

    ctrl+k+c to comment a block of code.

    ctrl+k+u to uncomment a block of code
     

  •  04-03-2007, 11:24 PM

    Re: XNA Fun Facts

    http://www.microsoft.com/downloads/details.aspx?FamilyID=C15D210D-A926-46A8-A586-31F8A2E576FE&displaylang=en Print this and hang it on your wall. :-)
    Several of us hang out on #xna on EFNet, why don't you?
    www.bortreist.com - My blog - XNA, programming, general geekery
  •  04-04-2007, 11:07 AM

    Re: XNA Fun Facts

    Thanks! That's great!  I love shortcuts :)
  •  04-04-2007, 2:36 PM

    Re: XNA Fun Facts

    There iz only 2 shirt-cuts u need 2 no, CTRL+C and CTRL+V.

    Only kidding :) I do not really speak like that, honest, I find Ctrl + - quite useful to jump back through the code you last visited.

    also Ctrl + M then L to collapse/expand all outlining.

  •  04-06-2007, 5:42 PM

    Re: XNA Fun Facts

    my favourite is used above any method prototype such as

     public returnVal myMethod(int param1, int param2)

    type /// and visual studio will put the following comments in

    ///Summary

    ///<@param1>

    ///<@param2>

    ///<@return>

    ///Summary 

    this allows you to comment your methods and when it is called the information is displayed in the drop down box.


    I have more fingers in more pies than a leper at a bakery.
  •  04-24-2007, 4:50 PM

    Re: XNA Fun Facts

    You can type 'prop' and then tab and it will insert a code snippet to assist with property and backing field for variables.
    It creates the following code, which makes it a lot faster to add private variables that still have the get/set properties availible.

    private int myVar;

    public int MyProperty
    {
    get { return myVar; }
    set { myVar = value; }
    }

  •  04-24-2007, 9:11 PM

    Re: XNA Fun Facts

    or type 'ctor' and press tab twice, for a constructor.
    It also works with 'for' and 'for each', when the words have green boxes around them press tab to jump around.


  •  09-14-2007, 7:26 PM

    Re: Useful Visual Studio Shortcuts

    One shortcut I get a fair amount of use out of is: Ctrl + . (period)

    If you type an identifier in a namespace you don't have a using statement for or if you try to call a non-existent method in one of your classes, the identifier will get a little rectangle under it. Ctrl + . will drop down a menu that will let you do things like automatically add a using statement at the top of the file or add a stub function of that name to your class.

  •  09-16-2007, 5:56 PM

    Re: Useful Visual Studio Shortcuts

    What I have is not exactely a keyboard shortcut but more a keyboard mapping setting, that can be set

    if you go to -  Tools -> Options -> Keyboard -> then chose Emacs in the "Apply the following additional keyboard

    mapping scheme"

    This will give you new shortcuts, that when learned are extremely helpful and save time.  Although it may take you some

    time to learn it although their are alot of them I only use about about 12 of them right now.  But of those most of them they are text navigation, which are the most helpful and when learned are dare I say fun to use!

    So what is so great about them is that once you learn them you never have move your right hand to the arrow keys!

    So here are some of them, to move the cursor forward one charcter it is 'Ctrl+f' and backwards it is 'Ctrl+b'.

    and forward one word 'Alt+f' and backward 'Alt+b', ALSO you can due page up 'Alt+v' and page down 'Ctrl+v' also without having to touch those keys. The highlighting of text is also possible without useing the MOUSE ha! This is down by starting a

    selection region from the cursor position by 'Ctrl+Space' then using the keyboard shortcuts above to move this selection regoin around it by moving the cursor, then when it is in the right place you due an-might have to check this yourself-'Alt-W' to copy it

    and then the region with go away then you again can move the cursor to were you want the text to go too with the shortcuts above without touching the arrow keys or the page up or page down buttons and then 'Ctlr+y' to paste.

    I was introduced to this 'scheme' as they call it 'Emacs' through school and work.  Emacs is the name of a prorammers text editor that is availble for windows linux.  You can find many refernce charts and tutorail and books about Emacs on the web

    just type in on Live search Emacs or Emacs shorcuts.

    Thier are many other shortcuts tons more.

    Anyways, I use it at work and I think that when you don't have to use the arrow keys, mouse, or page up, page down, and I forgot to mention home, and end at all when writing code, it is very ... I am at a loss for words.

    But just a thought, ...

  •  09-19-2007, 6:06 PM

    Re: Useful Visual Studio Shortcuts

    I can't get by without ctrl+M+O and ctrl+M+P, to open and close all regions of code.
  •  09-25-2007, 8:34 AM

    Re: Useful Visual Studio Shortcuts

    Ctrl+Space will auto-complete the current word using IntelliSense. If multiple completions exist it will show a list of possible matches.

    Ctrl+Shift+W will select the entire word in C# Express. (Ctrl+W only does this in Visual Studio Pro.)

    Ctrl+X will cut the entire line that the cursor is currently placed on (without anything selected).
    Ctrl+C will copy the entire line that the cursor is currently placed on (without anything selected).
    Ctrl+L will delete *without copying* the line that the cursor is currently placed on. (Ctrl+X is easier)

    Ctrl+T will swap two adjacent characters.

    Ctrl+] will jump the cursor to the matching brace when the cursor is placed on a brace.

    This link is an excellent reference for Visual Studio shortcuts. They are for Visual Studio 2005 Professional, but many of them are the same in Visual C# Express.
  •  09-25-2007, 3:39 PM

    Re: Useful Visual Studio Shortcuts

    Useless Trivia for the day:  Most of those C# coding shortcuts were originally created by none other than Joe Nalewabau, who is currently a PM on the XNA Game Studio team :-)
    XNA Evangelist Dude.
    http://letskilldave.com
    http://twitter.com/letskilldave
  •  09-26-2007, 8:53 AM

    Re: XNA Fun Facts

    Joel Martinez:
    my favorite is ctrl+k+d to auto-format your code

    Kyoryu33:

    ctrl+k+c to comment a block of code.

    ctrl+k+u to uncomment a block of code

    ctrl+e+d  /   ctrl+e+c  /  ctrl+e+u   also works so you don't have to stretch your thumb aaaaaall the way to K ;)

View as RSS news feed in XML
©2007 Microsoft Corporation. All rights reserved. Privacy Statement Terms of Use Code of Conduct Feedback