Posts Tagged 'Visual Studio'

Visual Studio 2008 keyboard shortcuts

Sometime back Bryan posted a blog in which he detailed his favorite shortcuts. While browsing through the net I found this good poster which details all the shortcuts.

Keyboard Shortcuts in Visual Studio (C#)

Hope this helps.

Happy Programming!!!



Debugging Stored Prcedures in Visual Studio

I was speaking with a developer friend of mine the other day and the topic of debugging stored procedures came up. My friend was unaware that this was even possible, so I thought that I would share.

In SQL2000 debugging was as simple as right clicking on a stored procedure in Query Analyzer and selecting Debug from the context menu. This was a simple, yet effective method, but is very limited in its capabilities. That feature was removed in SSMS (SQL Server Management Studio).

For SQL 2005 and above, this can be done in Visual Studio. In server explorer create a data connection. Drill down to the stored procedure that you want to debug and click “Step Into Stored Procedure.” From here you can step though the stored procedure.

Alternatively, you can right click on the stored procedure and select “Open” from the context menu. From there you can set breakpoints, change SQL blocks, execute SQL blocks and step into the stored procedure.

My two favorite features of debugging stored procedures in Visual Studio are the ability to see and change variables as you step through the code and the ability to see the managed code when you open a CLR procedure.

For a step by step explanation (with pictures) you can check out SQL Team‘s article, which explains the steps better than I.

Happy debugging!


Top 5 Favorite Visual Studio Features


Visual Studio is such a powerful tool. I believe it is one of the major reasons why I enjoy .Net development over other platforms.

I thought I would share my top 10 favorite Visual Studio features with their keyboard shortcuts. The ones I couldn’t live without. Then I realized I could only come up with 5. This made me think I need to spend some time exploring the application I use more than any other application (Firefox not included) in my toolbox. So here are my top 5. Check back later for my “Top 5 Newly Discovered Features” post.

In no particular order…

-Find All (Ctrl+Shift+F)

Highlight a search term and you can search across the current document, all open documents, an entire solution or an entire project. Your results window will pop up and you’ll be able to view the line that contains the search term. Double click the line to go to it in code. I don’t know why everyone uses the classic find and next when this is just as easy but much more powerful.

-Comment\Uncomment selected lines (Ctrl+K, Ctrl+C), (Ctrl+K, Ctrl+U)

This has to be one of the most used features ever. It is so basic I wouldn’t consider an IDE without it an actual IDE. Without this you might as well be developing in notepad.

-Collapse\Open code (Ctrl+M, Ctrl+O), (Ctrl+M, Ctrl+L)

This one is really great. Assuming you aren’t using regions (which really can interfere with the usability\readability here) you can enter this shortcut chord (Ctrl+M, Ctrl+O) to collapse all properties and method details for a nice clean view of your class. Pressing (Ctrl+M, Ctrl+L) will open the whole class again or you can open individual section using the (+/-) toggle to the left.

-Refactor Rename (Ctrl+R, Ctrl+R)

Naming is huge in writing good code. Sometimes it just isn’t easy to find that perfect name when you first create something or a better name becomes apparent as you add additional items that have similar names. With this feature renaming a variable, method, property or class becomes 2 seconds of work. A lot of people may use search and replace but this actually uses the compiler to ensure it only renames what it should.

-Go to Definition (F12)

I remember when I first saw another developer use this and I couldn’t believe I had been working in VS for almost 6 months without knowing about it. Again it is so basic some may forget it is actually a feature but I’m sure if I captured my keyboard shortcuts it would be up at the top of the list of most used.