Other Posts in Visual Studio

  1. Getting Public Key and Public Key Token of a DLL, the Easy Way
  2. Automatically Splitting a Project into Smaller Projects in Visual Studio
  3. Basic Shortcuts in Visual Studio That I Use

Basic Shortcuts in Visual Studio That I Use


So apparently a couple of people have complained about the fact that I have line numbers in the code that I show. Apparently people have been going line by line and deleting the numbers. My first response was "Wow, that's inefficient... Wait do they not know about column selection?"  You see Visual Studio has this little feature that lets you select a column (really a block) of data. All you do is hold down the alt key when selecting something and you can select a column of data. So you do that, select the numbers before my code, and hit delete and you have usable code. And if these guys didn't know about that little trick, maybe they didn't know a couple of others in Visual Studio:

  • Hold Alt while selecting = column select mode (don't need to continue holding).
  • ctrl+K, ctrl+C = comment out a section
  • ctrl+K, ctrl+U = uncomment a section
  • ctrl+M, ctrl+O = collapses all regions (functions, etc.)
  • ctrl+M, ctrl+L = shows all regions (functions, etc.)
  • ctrl+. (dot) = Show smart menu (whenever you see that weird blue underline, it brings up a menu of options related)
  • ctrl+N = New file dialog
  • Shift+Alt+Enter = Full screen mode (I only use this when I'm trying to show code to people on a projector or something)
  • ctrl+tab = goes between child windows and brings up the nice "active files" window so you can pick the file you want (at least in 2010 anyway).
  • F5 = debug (also in break mode causes the execution to continue, but if you don't know that, that's rather worrisome)
  • Ctrl+F5 = compiles and runs the app (no debug)
  • Shift+F5 = kills debugging session
  • F4 = displays the properties window
  • ctrl+K,ctrl+D = formats the code in the window
  • Shift+del = deletes a row
  • F12 = Go to definition

Those are the ones that I use frequently enough anyway. Or at least ones that I can remember off the top of my head. Anyway hopefully this helps someone out. Try them out and happy coding.