We pay for user submitted tutorials and articles that we publish. Anyone can send in a contribution
Learn MoreAfter publishing 10 Visual Studio shortcuts you must know and then 11 more Visual Studio shortcuts, a colleague of mine, Elan Kynsky, introduced me an MSDN page called Visual Studio 2005 IDE Tips and Tricks. This is a long article where you can learn
a couple of useful things about Visual Studio, but what attracted me most, was the “Creating a keyboard shortcuts cheat sheet” section.
As we all know, there are a lot of keyboard shortcuts in Visual Studio. We mentioned only 21 of them here at Dev102.com but according to this article, there are about 450 shortcuts available. That fact, made me realize that I know less than 10% of them… Fortunately, we can write a macro that enumerate all of the available shortcuts. To achieve that goal, go to Tools->Macros->”Macros IDE”, a macros window will pop up, expand the MyMacros project (in the project explorer), expand MyMacros namespace and double click on Module1. Copy the following code to the Macros IDE and run it.
The code, copied from the article:
Public Module Module1 Public Sub ListShortcutsInHTML() 'Declare a StreamWriter Dim sw As System.IO.StreamWriter sw = New StreamWriter("c:\\demo\\Shortcuts.html") 'Write the beginning HTML WriteHTMLStart(sw) ' Add a row for each keyboard shortcut For Each c As Command In DTE.Commands If c.Name <> "" Then Dim bindings As System.Array bindings = CType(c.Bindings, System.Array) For i As Integer = 0 To bindings.Length - 1 sw.WriteLine("<tr>") sw.WriteLine("<td>" + c.Name + "</td>") sw.WriteLine("<td>" + bindings(i) + "</td>") sw.WriteLine("</tr>") Next End If Next 'Write the end HTML WriteHTMLEnd(sw) 'Flush and close the stream sw.Flush() sw.Close() End Sub Public Sub WriteHTMLStart(ByVal sw As System.IO.StreamWriter) sw.WriteLine("<html>") sw.WriteLine("<head>") sw.WriteLine("<title>") sw.WriteLine("Visual Studio Keyboard Shortcuts") sw.WriteLine("</title>") sw.WriteLine("</head>") sw.WriteLine("<body>") sw.WriteLine("<h1>Visual Studio 2005 Keyboard Shortcuts</h1>") sw.WriteLine("<font size=""2"" face=""Verdana"">") sw.WriteLine("<table border=""1"">") sw.WriteLine("<tr BGCOLOR=""#018FFF""><td align=""center""><b>Command</b></td><td align=""center""><b>Shortcut</b></td></tr>") End Sub Public Sub WriteHTMLEnd(ByVal sw As System.IO.StreamWriter) sw.WriteLine("</table>") sw.WriteLine("</font>") sw.WriteLine("</body>") sw.WriteLine("</html>") End Sub End Module
Notice that this code creates the following file: C:\demo\Shortcuts.html. To make your life easier, I did the whole process and uploaded the results as a Visual Studio Keyboard shortcuts Cheat Sheet page. You can use it (notice that if you customized some of the keyboard shortcuts, you will have to do the whole process by yourself) and as written in the MSDN article, feel free to print it out and post it near your computer. Hope you find it helpful, enjoy…
Tags :
.Netcheat sheetKeyboardmacroShortcutsVisual Studio Copyright © 2012 Dev102.com
Breeze : Designed by Amit Raz and Nitzan Kupererd
Glenn
Said on June 12, 2008 :
Is there a Key-Board Shortcut to stop Visual Studio from freezing up and being a CPU pig?
Pawel
Said on March 22, 2009 :
Hey
You’ve made a small mistake. You do not use any additional imports (at least you did not write about it) and then:
Dim sw As System.IO.StreamWriter
sw = New StreamWriter("c:\\demo\\Shortcuts.html")
The second referens is invalid.
Better
Dim sw As System.IO.StreamWriter
sw = New System.IO.StreamWriter("c:\\demo\\Shortcuts.html")
And you also have some additional new lines in one of se.WriteLine.
Well, it is not any significant mistake, but you cannot do copy-paste (you’ve done it on purpose? :))
Thx for code - I never used VBS and I haven’t been aware that you actually can print all keyboard shortcuts.
Bob
Said on May 11, 2009 :
This is great and BTW, the mistakes (hard to even call them mistakes) were extremely minor and a breeze to fix!
Raj
Said on November 5, 2009 :
Thanks. Its really helps a lot.
zeysvinlktr
Said on April 8, 2010 :
?????? ????????, ????????? ??????? ????????.