What is the keyboard shortcut to collapse current region in VS2008? - visual-studio

By "current region" I mean a region where the cursor is.
EDIT: I am looking for region toggling, not outlining expansion toggling. By "region" I mean section of code defined by #region and #endregion directives. Ctrl + M, Ctrl + M toggles closest outlining (which for most cases would be current method not region).

CTRL + M, M should do the trick
By the way you can download a "poster" of shortcuts here

It can differ from mapping to mapping but the default is :
Ctrl + M , Ctrl + M

In Visual Studio 2010 use CTRL + M , CTRL + S. I did not check Visual Studio 2008

Related

Whats the visual studio equivalent to eclipse alt + arrow Left

From Eclipse i'm confortable with
F3 to enter a method and ALT + <-
In visual studio (2010) its F12 to enter the method, but how do i get back to the call, where i jumped in?
You can use Shift + F12 to list all references, and the original method will be listed.
Ctrl + - will navigate backward, whilst Ctrl + Shift + - will navigate forward (in the context of where you were working in your code).
Ctrl + , will allow you to search for a method to navigate to.
In my VS Code V 1.20.1 the shortcut is:
Ctrl + Alt + - for backward.
For going forward is Ctrl + Shift + -.
We can change these shortcuts just like in Eclipse by selecting the menu File -> Preferences -> Keyboard shortcuts, and type on the search field for Go Back or Go Forward.
To do this on MacOS VS Code
^+- to go backward.
^ + shift + - to go forward.
Note that^ is control on your keyboard.
Full list of other mac keyboard shortcuts here: https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf

how to enable the comment buttons in visual studio

I am using visual studio.
In the tool bar,"comment" and "uncomment" buttons are disabled.
and If I use Ctrl + K and Ctrl + C` also ,I am not able to comment the code.
how to solve this?
It's CTRL + K + C not CTRL + K and CTRL + C :)
You need to select some text with your mouse to use those buttons. You also can't be in a state where editing is locked (such as while debugging).

How to uncomment multiple lines of code in Visual Studio

I did a ctrl K + ctrl C (adds // to a line) on a lot of lines of code that I need uncommented. What is the quick key method to uncomment code in Visual studio?
Ctrl+K, Ctrl+U removes the // comments
I believe it is Ctrl + K, Ctrl + U.
Ctrl + K, Ctrl + U.
There is also a button for it on the Standard toolbar.
ctrl + /
can be used for adding and removing comments.
Try + U or click the little icon on the toolbar.
If you're using Resharper, there is a much nicer alternative:
just right Alt + / for both
By using this single shortcut, you can simply toggle between commenting/uncommenting code, without having to remember/switch between two shortcuts for each.
Ctrl + K + C (to comment) and Ctrl + k + U (to uncomment the code)
Or
or use Ctrl + / (for the same)
Qwerty: Ctrl + /
Azerty: Ctrl + :
Just wanted to add, that in the latest version of VS, ctrl + u makes it caps. They instead made it a toggle command, so it is actually just ctrl + k again to make it uncommented.
I have the german keyboardlayout.
VSCode-x64-1.52.1
To leave a comment:
You have to highlight the code, then push
Ctrl + #
or
Ctrl+K, stay at Ctrl and push C
to commen out:
Ctrl + #, it toggles on/off the comment
or
Ctrl + K, stay at Ctrl and push U
Mine was a bit different. It is ctrl-shift-C to comment and ctrl-shift-alt-C to uncomment.
I am using Visual Studio Community 2017.
Ctrl + Q alternates between comment and uncomment.
Unfortunately Ctrl K Ctrl U does not work in few environments, rather it adds instead of removing. My case on windows, using composer file I faced Ctrl K Ctrl U not working.
I m using VS Code, ver 1.36.1
links to all keys short cuts: https://code.visualstudio.com/docs/getstarted/keybindings
In Visual C++ 2019 Ctrl + Shift + / both comments and uncomments.

Way to see assigned visual studio shortcuts with given prefix

Is there a simple way to see assigned shortcuts with given prefix? Something similar to emacs Ctrl + M, Ctrl + H. I can do it in following way, but hope, that there is more simple solution:
Tools -> Customize -> Keyboard
In "Press shorcut keys" press given prefix (say Ctrl + M)
In "Shortcut currently used by" combo-box there is a list of assigned shortcuts with given prefix
Wintellect has a macro that will list all Visual Studio shortcuts. Run that and you can do any analysis on the output you like.

Visual Studio 2008 - jump to line number shortcut

I can go to a specific line number by double clicking in the status bar in Visual Studio. Is there a keyboard shortcut that does the same thing?
Ctrl + G
Check out all the keyboard shortcuts at:
http://www.microsoft.com/downloads/details.aspx?familyid=e5f902a8-5bb5-4cc6-907e-472809749973&displaylang=en
Ctrl + G works for me.
If it doesn't work for you, you can always map whatever shortcut you want under Tools | Options | Environment | Keyboard.
EDIT: Yes, as #Brian mentions, the command in this case is Edit.GoTo
I just realised that the default in C# settings for this command is Ctrl + G, whereas in VB Settings, there is no default keyboard short - it's mapped to show the immediate window - strange I think. I swapped the mappings so that the two environment behave the same.
Every IDE or even text editor I have ever used either uses Ctrl + L or Ctrl + G for this purpose.
I assume this could stand for Ctrl + Line or Ctrl + Goto
Yep Ctrl + G.
From this answer you can get a nice Shortcut poster.

Resources