Monday, March 13, 2006

Getting Ctrl-Shift-F2 back in Visual Studio .Net

One feature I used a lot while working in Visual Basic 6 was the ability to press Shift-F2 on the name of a routine and instantly jump to that routine's code to investigate something about that routine. Once finished, I could press Ctrl-Shift-F2 and jump back to the calling program where I left off and continue on with my previous task. Very productive.

In Visual Studio.Net, under the default keyboard mappings, Shift-F2 is replaced by F12. This is an improvement since I don't have to press the Shift key to go to a code routine's definition. But the equivalent for the Ctrl-Shift-F2 to jump back to the original source code location is nowhere to be found.

In Visual Studio.Net terms, the equivalent for the VB6 Shift-F2 functionality is Edit.GoToDefinition and the equivalent for Ctrl-Shift-F2 is View.NavigateBackward. I used the Visual Studio.Net keyboard customization options to assign these functions to F12 and Shift-F12 respectively. Now I once-again have the ability to investigate a routine, jump back to where I left off, and the keystrokes are more convenient and intuitive than before. I'm diggin' it.


Hope you found this helpful.

Joe.

4 comments:

Joe Kunk said...

You can also use the ctrl+- (ctrl-minus) key to navigate backward if you wish.

Anonymous said...

View.NavigateBackward
CTRL + MINUS SIGN (-)
Moves to the previously browsed line of code.

http://msdn.microsoft.com/en-us/library/ms366755(VS.80).aspx

Anonymous said...

Thanks a lot : old habits are hard to change.

SUHAIL AG said...

Thanks..
Ctrl + Shift + 8 also work c#.net but not in vb.net