Visual Studio .NET 2003 and 2005 Keyboard Shortcuts

I've been trying to improve my use of keyboard shortcuts in Visual Studio .NET. Here are the ones I use most often, what I consider my "core" keyboard shortcuts:


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2005/06/visual-studio-net-2003-and-2005-keyboard-shortcuts.html

I’m still struggling to find a keyboard shortcut that sets the input focus back to the code window after doing a ctrl+alt+O or ctrl+alt+K

Answering my own question, F7. I could have sworn I tried this earlier and it didn’t work.

I should have also mentioned ctrl+PgUp and ctrl+PgDn which I use all the time. That switches between “tabs” at the bottom of whatever pane you’re on, fex, between the HTML designer and the code view.

Hmm, that’s interesting, it runs fine as-is on my Beta 2. It’s version 55603-000-0000016-00696, whatever that means.

I would like this macro to write the HTML keyboard shortcut summary content to a new html browser window in the IDE (instead of the output console), but I lack the technical chops to do so…

Very nifty, thanks!

One addendum… in VS 2005 Beta 2, I had to declare all functions/subs and the _p variable as “shared” before I was able to execute List from the Visual Studio IDE.

I recall that VS 2003 allowed the direct execution of non-shared macro functions without first instantiating the class. Apparently that’s no longer possible now.

Macro overview tips (from PowerToys team):

http://blogs.msdn.com/powertoys/archive/2004/04/26/120763.aspx

Macro samples:

http://blogs.msdn.com/powertoys/archive/category/4817.aspx

Google search macro:

http://www.eggheadcafe.com/articles/20040423.asp

code Spellcheck macro:

http://www.codeguru.com/Cpp/V-S/devstudio_macros/article.php/c5981/

Great tips. F7 doesn’t work for me though in VS.NET 2003.

My favorite VS shortcuts:

Ctrl-W (select current word under the cursor)
Ctrl-F3 (Search for current word under the cursor)
F3 (Find again - I use this all the time)
Ctrl-Tab (Next open document, you can also use this to toggle between documents like Alt-Tab does for windows)

And of course all the num keypad combinations: Ctrl-Pgup, Ctrl-Pgdn, Ctrl-Home, Ctrl-End. Can’t live without them. Also I still use the num keypad instead of the arrow keys.

I’ve gotten used to Ctrl-Shift-B to build the current project in VS 2003, but I think the shortcut is different in the new versions I still prefer the old Ctrl-F7 (?) way of building code.

How about some useful IE shortcuts:

Alt-D (go to url address bar)
Alt-A (Favorites menu)
Backspace/Ctrl-Left (back to previous url)
Ctrl-Right Arrow (forward url)

Once you get used to certain shortcuts it becomes entirely second nature and you never go back to using the mouse.

Ctrl-F3 (Search for current word under the cursor) F3 (Find again - I use this all the time)

Let me introduce you to my little friend CTRL+I! I rarely use F3 after finding out about this little gem known as “incremental search”.

Hmm, that’s interesting, it runs fine as-is on my Beta 2. It’s version 55603-000-0000016-00696, whatever that means.

Looks like you got a newer version than me. Mine is the one that came on the MSDN Pro subscription DVD, and the version of Visual Basic and the other products is 55603-000-0000016-00460. The Visual Studio version is 8.0.50215.44.

If these jokers have actually updated the MSDN download compared to the DVD distribution I guess I’ll have to download the Team System install, after all…

Ctrl-I - Nice, I like the way your fingers never have to leave the keyboard while doing the search, and you can also do Ctrl-Shift-I to search backwards. Only problem is I use other editors other than VS.NET (notepad2 for one) and Ctrl-I doesn’t work on the rest without additional remapping.

“I’m still struggling to find a keyboard shortcut that sets the input focus back to the code window after doing a ctrl+alt+O or ctrl+alt+K.”

Shift+ESC should close the Output or any other “smaller” window and return the focus back to the code window.

CTRL± and CTRL+SHIFT± for navigate backward and forward. I remapped them to ALT+LEFT ARROW and ALT+RIGHT ARROW so they work like every other application that has back and forward buttons.

Ctrl± for back and Ctrl+Shift± for forward? Isn’t that the most illogical shortcut ever? Why not use Ctrl++ for forward? Semantically it makes far more sense.

CTRL± and CTRL+SHIFT± for navigate backward and forward. forward. I remapped them to ALT+LEFT ARROW and ALT+RIGHT ARROW

You know, I totally agree with this, but… I already use the alt+arrow combos to navigate the cursor around, so that’s a showstopper!

Jeff,

Not sure why this is happening but in a later VS 2005 build, a command with the name “New Folder” breaks the parsing code in ParseBindings. Just changed the code slightly and everything works fine:

Dim sa() As String = Regex.Split(cmd.Name, “.”)
dr.Item(“Category”) = sa(0)
If (sa.Length 1) Then
nbsp;nbsp;nbsp;nbsp;dr.Item(“Command”) = sa(1)
Else
nbsp;nbsp;nbsp;nbsp;dr.Item(“Command”) = ""
End If

Interesting. NewFolder is the only command like that-- it has a category but no command (?). This is new to the PDC build of VS.NET 2005.

Your bugfix is totally correct though. I’ll update the code snippet.

Well, I found the CTRL+M - CTRL+O and CTRL+M - CTRL+M shortcuts quite handy to collapse to definition/expand region under cursor …

Also for large blocks I’m using CTRL+K - CTRL - C and CTRL+K - CTLR - U fairly often for Comments, but the latter two differ in different language versions of VS.

The CTRL± is something I really missed quite often after browsing through a big class and then searching for my last edit point … and ended up using UNDO-REDO to find my way back :wink:

Cant use CTRL+PgDn/CTRL+PgUp in VS2003 - for me is simply navigate between top of page and bottom. What I missing? Maybe because I use laptop… Actialy I looked something for switch between editor tabs in next/prev order but not in history like CTRL+TAB/CTRT+Shift+TAB?

Thanks all for the tips.

So far in the release version of VS 2005, you can switch to code view from the HTML using F7, but from code view shift F7 no longer works to return you to HTML view, boo. You have to right click, select design, then Control + Page Up to get back.

Am keeping my fingers crossed for the service pack.

hth

I guess I’m a visual person so I think they broke Ctrl+Tab in 2005. I don’t want to read a list of file names. I want to see the next in a series of forms and/or code and I want to do it quickly. I use Ctrl+F6 and Ctrl+Shift+F6 now, but it took me a while to find the new way to do things.

i am BE(info tech)student so plase send me samples of vb.net code and projects on it and i
want get codes on text to speech,and network monitoring tool