In this post, we will learn what’s shortcut key for comment and uncomment in Visual Studio as well as we’ll explain how to show comment and uncomment in Visual Studio Toolbar.
Applies To
- Visual Studio 2019.
- Visual Studio 2017.
- Visual Studio 2015.
- Visual Studio 2013.
You might also like to read GitHub Extension in Visual Studio
Missing comment and uncomment in Visual Studio 2019
I have opened Visual Studio, and I had noticed that the comment and uncomment button box is not shown in Visual studio toolbar as displayed below:
I would like to show comment and uncomment button to be like below:
Show comment and uncomment in Visual Studio 2019
In Visual Studio, the comment and uncomment buttons are included in the Text Editor option, and Visual Studio 2012 (and maybe later versions) does not add the Text Editor option in the Visual Studio toolbar by default.
So to show comment and uncomment in Visual Studio, you should enable Text Editor option by doing the following:
- Click right on any free space in the Visual Studio toolbar, then select “Text Editor”.
- The below buttons should be added to Visual Studio toolbar!
- In old Visual studio versions like Visual Studio 2008 / 2010, the comment and uncomment icons look like the below.
Shortcut key for comment and uncomment in Visual Studio 2019
Besides the comment and uncomment button in Visual Studio toolbar, you can also use the keyboard shortcuts to perform the same actions
Shortcut key for comment in Visual Studio 2019
- Select the piece of code that you would like to comment on.
- Then click CTRL + K + C to apply comment on the selected code.
Shortcut key for uncomment in Visual Studio 2019
- Select the piece of code that you would like to uncomment.
- Then click CTRL + K + U to uncomment.
Conclusion
If the Text Editor is not enabled in Visual Studio, you will not be able to find the comment and uncomment in Visual Studio. so here, we have tried to show these buttons in the Visual Studio toolbar. Also, we have provided the Keyboard Shortcut key for comment and uncomment in Visual Studio 2019.