Comment and Uncomment Selection – Microsoft Dynamics NAV 2015

Microsoft Dynamics NAV 2015 comes as a collection of lot of small small modifications ( Advance features also there). One of the small features available in Dynamics NAV is commend and uncomment section of code. 

In previous versions what we used to do use is {} or // to  comment a section or line. 

With the use of {} we can comment a block of code line, however it will not change the appearance of the code and after a some time when you again go through your code you will sometime miss the {}.

 No change to the appearance of the code.

So best practice is to use // to comment a code because it change the color to green so the next person who will be modifying this code segment will can easily see it.

 change happen to the appearance of the code.

However, down side of this is that developer has to go through each and every line to comment it and if he want to uncomment it that also the same and it take consume lot of time. 

Like Visual Studio we didn’t had a function to comment a block of code section. BUT with Microsoft Dynamics NAV 2015, Microsoft has introduced this as a new feature and it really helps us to do this more efficiently and effectively


If you go to design view and go to Edit menu you will see two new command lines added to menu. 

To use this select few code line and then click “Comment Selections…” under the Edit Menu or can use the shortcut key Shift+Ctrl+K and it will comment the selected lines by setting two forward slashes in front of the code. 

This goes same with the Uncomment and for the shortcut key for that is Shift+Ctrl+O

Thank you and Regards,
Tharanga Chandrasekara.

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

2 comments

  1. Very Nice Post Thank You For Sharing

    • Unknown on December 7, 2017 at 8:26 pm

    Thank you for the feedback.

Comments have been disabled.