Sébastien Richer
By Sébastien Dec 6, 2021

Visual Studio and SQL Server Management Studio: Tips and Tricks for Full-Speed Coding!

You can find a few articles out there offering tips and tricks for programs like Visual Studio (VS), SQL Server Management Studio (SSMS), and the developer environment in general. Here’s ours! We don’t pretend to list every trick in the book, but we’ll give you our own. Bear in mind these are small tips, not big, process-changing ones.

We won’t be covering screenshots, practical software, or VS Code, as these subjects are very broad. We may devote future articles to them.

VS and SSMS Tips

Formatting

We’ll start slowly with CTRL+K, CTRL+D, which is very useful for formatting a file automatically. When I make changes, it is often my first commit if there are formatting adjustments to be made, so that the code changes are more explicit in the commits.

You can also use CTRL+R, CTRL+G to adjust and sort the usings automatically.

The VS formatting configurations are very powerful, but I usually stick with the defaults as they work fine for me.

There is at least one VS extension on the Visual Studio Marketplace: Format All Files. However, this takes longer for a project with numerous files.

Class Readability

The shortcut CTRL+M, CTRL+O allows you to reduce methods to their definitions. Combined with the /// (triple slash) for documentation, this returns a very reader-friendly result.

We also like to use regions when it helps visibility.

Caution, though: when the class gets big enough to add regions, it could be a sign that it’s too big and can be split. You can also adjust the color of the keyword by changing the Preprocessor Keywords and Text elements.

Visual Studio SQL Server Management Studio Tips and tricks - Regions

Window Management

My favorite feature of both VS and SSMS is the “Show pinned tabs in a separate row” option. This little feature lets you place a few open files in quick access, which comes in handy when browsing many documents at the same time. In my opinion, this is the tips-and-tricks MVP (Most Valuable Player)!

Visual Studio SQL Server Management Studio Tips and tricks - Show Pinned Tabs
Visual Studio SQL Server Management Studio Tips and tricks - Show Pinned Tabs

Its not-too-distant little cousin on the Windows taskbar lets you pin files. Personally, I often put VS .sln files, useful SSMS requests, and files I use regularly with other applications here.

Visual Studio SQL Server Management Studio Tips and tricks - Pin to this list

Speaking of SSMS, enabling line numbers makes it easy to communicate when sharing screens with colleagues. Who knows why SSMS does not activate this feature by default?

Visual Studio SQL Server Management Studio Tips and tricks - Line numbers

In both editors (VS and SSMS), I really miss the CTRL+W shortcut that closes the current window, which you can find in other programs like Chrome. But don’t worry, you can configure it!

In Tools – Options – Environment – Keyboard, you just assign CTRL+W to “File.Close.” We have to disable the other commands (like Select Current Word… does anyone use this shortcut?) and enter the new shortcut in Global.

You can also click on your mouse’s middle (wheel) button to close windows, as with other programs (browsers, VS Code, etc.).

File Close

Another trick I really love are the little Back and Forward arrows that look like web browser buttons. At first, I didn’t like them at all, but as I got used to more elaborate class and method systems, they quickly gained a place in my heart.

Visual Studio SQL Server Management Studio Tips and tricks - Navigation

On a personal note, a few years ago Microsoft launched the file preview feature enabled by default on definition navigations. I never liked it, perhaps because my CTRL+W was never far away. 😉 At any rate, here’s how to disable it: Tools – Options – Environment – Tabs and Windows.

Visual Studio SQL Server Management Studio Tips and tricks - Preview Tab

Speaking of which, one recently-introduced VS feature that has received rather mixed reviews is opening .csproj on double-click by default, instead of expand-shrink project. No worries: Tools – Options – Projects and Solutions – General, and you’re all set!

Visual Studio SQL Server Management Studio Tips and tricks - Open project files

Exporting and Importing Configurations

Finally, while having to maintain a great deal of configuration in our editors’ settings, we sometimes have to change workstations. Exporting and importing these settings is thus very useful for saving time! You can find it in the Tools menu.

I always keep an up-to-date exported file on the cloud to use when needed, or to share.

Visual Studio SQL Server Management Studio Tips and tricks - Import and Export settings

Tips for VS Debug Mode

Not long ago, Microsoft added a new feature to modify code at runtime: Apply code changes (or Hot reload with VS 2022). We’ve started using this option and, even if it doesn’t support all the changes, we can already see the value and improved speed it can offer.

Visual Studio SQL Server Management Studio Tips and tricks - Apply code changes

In debug mode, after setting a breakpoint, you can move the playback cursor by clicking on the small yellow arrow in the margin and dragging it to the desired location. Very practical when combined with Hot reload!

We also use the immediate window or the watch occasionally to change the values and quicky retry a piece of code.

Visual Studio SQL Server Management Studio Tips and tricks - Next statement that will be executed

One more for the road! CTRL+SHIFT+F9 lets you quickly delete all breakpoints. It gives a bonus feeling of satisfaction that comes with the end of a good debugging session.

Conclusion

So here’s a handy little list that finally isn’t so little after all! Do you have any tips or tricks that you regularly use? We’d love to hear about them! Share them with us on LinkedIn and Facebook. Who knows, we might add a few to our list soon!

Recommended Articles
Published on March 21, 2023

Tech Report - Our Top 11 Visual Studio Code Extensions for 2023

These 11 Visual Studio Code extensions are, in our opinion, the best on the market. They greatly improve the overall work-life quality of developers.

Read more
Published on June 27, 2023

Tech Report - Our developers' top 10 resources!

Tech, data, programming and AI are your favourite subjects? Would you like to keep up to date in these areas and stay on top of the latest trends? Our developers have put together a list of their favourite resources for you.

Read more
Share on