Visual Studio .NET 2003 and 2005 Keyboard Shortcuts

I mention this on another entry here but I made a program that makes it easier to remember keyboard shortcuts for Visual Studio and other programs too. So hope it helps someone here and always appreciate feedback on how we can improve. Thanks. a href="http://www.ghostclip.com"http://www.ghostclip.com/a
Curtis

In case anybody is interested, I created a Studio Shortcut Cribsheet that categorizes the most useful (IMO) Visual Studio shortcuts into one page. It’s posted on my blog.

how to clear the contents of immediate window using a shortcut key ?

I’ve used Ctrl-Shift-B to build the current project in VS 2003,I prefer the old Ctrl-F7 way of building code.

omhoge:

I use this litlle macro to switch to markup from the code.
Just bind it to your favorite shortcut (like shift-f7 in the text editor).

Sub SwitchToMarkup()
If (DTE.ActiveWindow.Caption().EndsWith(".cs") Then
Dim FileName = DTE.ActiveWindow.Document.FullName.Replace(".cs", “”)
If System.IO.File.Exists(FileName) Then
DTE.ItemOperations.OpenFile(FileName)
End If
End If
End Sub

Ctrl+F2 takes you to the navigation bar!
helps me a lot …

To “stand on the shoulders” of Mikael H’s great little macro, I’ve extended it to toggle back forth between markup the source code. Coming from a Delphi background, if you bind the macro to F12 you’ll feel right at home and developing with speed!!

Sub SwitchToMarkup()
    Dim FileName

    If (DTE.ActiveWindow.Caption().EndsWith(".cs")) Then
        ' swith from .aspx.cs to .aspx
        FileName = DTE.ActiveWindow.Document.FullName.Replace(".cs", "")
        If System.IO.File.Exists(FileName) Then
            DTE.ItemOperations.OpenFile(FileName)
        End If
    ElseIf (DTE.ActiveWindow.Caption().EndsWith(".aspx")) Then
        ' swith from .aspx to .aspx.cs 
        FileName = DTE.ActiveWindow.Document.FullName.Replace(".aspx", ".aspx.cs")
        If System.IO.File.Exists(FileName) Then
            DTE.ItemOperations.OpenFile(FileName)
        End If
    ElseIf (DTE.ActiveWindow.Caption().EndsWith(".ascx")) Then
        FileName = DTE.ActiveWindow.Document.FullName.Replace(".ascx", ".ascx.cs")
        If System.IO.File.Exists(FileName) Then
            DTE.ItemOperations.OpenFile(FileName)
        End If
    End If
End Sub

Also, regards alt-tab being “broken” by Microsoft, did you know you can go to the Tools/Options/Keyboard and remap Alt-Tab from being bound to “NextDocumentWindowNav” to plain old “NextDocumentWindow” and it’ll be how it was before (no pop-up window on alt-tab)

I’m gonna try posting this here in the off-beat chance it might get a response. On previous vs.net installations, if I had several classes open, as I ctrl-tab’d through them or clicked on them manually with the mouse, the project explorer would automatically highlight the current item being edited. It doesn’t happen anymore!! This behavior only shows on my work PC and my home PC. My work PC is a brand-new install of visual studio.net 2003 enterprise. I was surprised to see it happening on a brand new install.

Does anybody have any ideas what might be wrong and how I can fix this? It is so much easier to keep track of where I am when the project explorer window automatically highlights the selected file :frowning:

Andres…

Go to Tools-options-Projects and Solutions-General and check "Track active item in solution explorer

I find it very useful too…its turned off by default not sure why?

Another one I use - Ctrl-Shift-F9 for clearing all breakpoint. After you’ve been debugging something down a looong path and you’re ready to move on.

Absolutely incredible… It ll help me lot.

One thing that seems to be missing (unless I’m just reading over it) is a way to jump to the end of an XML tag. When using the XML documenting in VS 2005, if I’m working on a list of things, it’s a real pain to have to grab the mouse when I’m finished in a tag.

thank advance. Now i try find short cut key using in visual studio.

To collapse all blocks Ctrl-M-O very helpful.

Also with keyboard to expand a block #Region xyz […] Press Space and right arrow and it will expand.

You should use Resharper :slight_smile:

Anyone know the shortcuts to trigger the class or method dropdowns in the c# editor?

Some of the most used… just in case some one is refering http://sumtechstuff.blogspot.com/

I use ctrl + M, ctrl + O quite often (to collapse code) so that I can see where I am.

Organize organize.

I also use ctrl + M, ctrl + O quite often, but I would really like to know the reverse shortcut (expand all). I have to scan visually and expand manually. This is very tedious, since an expanded block can itself containned a collapsed block.

Ctrl-k-k (hold down Ctrl and press k twice) - Inserts a bookmark on your cursor’s line

Ctrl-k-c (hold down Ctrl and press k then c) - Comments out the current or selected lines

I would like to know if there’s a shortcut to disable the current breakpoint–for times where you just want to disable the breakpoint on the fly