Welcome to Null City Software
Tasty, tasty software.
Null City Logo Home Kitae Breeze Products Login Forums Contact Us About Us
Visual Studio is a huge sprawling mature application which has been around for a staggering 12 years. I use Visual Studio both at work and for my own projects, and I've been using it now for a good 8 of those 12 years. So I thought I'd pass on a few gems I've picked up along the way. See how many of these you already know.

In no real particular order.

10) Visual Studio 2002 had a Clipboard Ring dockable window that held a buffer of everything you copied in Visual Studio this allowed you to both view and rewind text you had copied in the editor. As far as I'm aware, the dockable Clipboard Ring window was removed. However, you still have access to this through a menu and shortcut key combination. In the editor, keep tapping CTRL+SHIFT+V to cycle through the clipboard ring.

9) Problem: You know the name of a file in your solution but you cant remember where it is? One Solution: using the find box on the Standard toolbar, type ">of [filename]" and as you type, Visual Studio will offer you a drop down of files in the solution that match what you are typing. Simply press up/down and enter to select the file you want to open.

8) It's quite easy to miss these buttons (sometimes mapped to Mouse Button 4 and 5 if you have them):

These are totally invaluable to me. Visual Studio keeps track of every document you move between and the location of the caret. These buttons allow you to move backwards and forwards through that history which is incredibly helpful in large projects.

7) Document Outline Window. This baby has been around for a while now, but is very easy to miss. If you do a lot of WinForms development this window should be on display at all times if you can squeeze it in because it makes renaming controls incredibly easy and allows you to view the hierarchy of your controls. This window can be reached through the View > Other Windows > Document Outline menu by default, or by pressing CTRL+ALT+T. If like me, you tend to build a whole user interface and then worry about renaming the controls after you've built it, then this window is for you. Build your UI as normal, then start from the top of the Document Outline window and work your way down to the bottom hitting F2 to rename your controls as you go.

6) Quick Watch - Probably the best place to test inline code while debugging. The QuickWatch window, which I generally remap the keyboard shortcut for to F9, will evaluate pretty much any code you type into it at run-time. When debugging, break into your code, select a chunk of code in the editor and Right Click > Quick Watch to display the Quick Watch window. Here you can tweak the expression and view its results.

5) Using the Toolbox as a snippet container. There will always be times whilst programming when you need to have more than one chunk of text in the clipboard. Visual Studio makes managing this situation very easy, simply create a new tab on the Toolbox by Right clicking in the empty space and selecting "Add Tab", give it a name and hit enter. Now simply drag and  drop code from any editor directly into the new tab. Nice huh? Additionally, once you've dropped code into the new tab you  can right click the item and rename it to something more useful if it's code you use frequently.

4) Some time ago, Microsoft added the "Tab Order" button to the WinForms designer, but it may have gone unnoticed by some.  Tab Ordering is very important for those of us who like to use the keyboard wherever possible, and is very good UI  practice to set up correctly. Whilst doing so is a complete pain in the ass, it is somewhat easier to manage with the "Tab  Order" item on the Edit Menu. When you have finished setting up a user interface in the WinForms designer, simply select  Edit > Tab Order and you will get an overlay on top of your user interface. Click each of your controls in the order you want them to activate when the TAB key is pressed by the end user. When done, select the Edit > Tab Order menu item again. The most annoying thing is, you still have to do it every time you insert a new control in the middle of your form, but hey, it's easier than doing it manually.

3) Modify those keyboard shortcuts to suit your own needs! Everyone knows where it is, Tools > Options > Environment > Keyboard, but very few people actually bother tailoring them to their own needs. This is a bit of a shame, because keyboard shortcuts set up properly can seriously speed up develepment and save on many hundreds to thousands of mouse clicks. No really, it pays dividends over time, and with the ability to export and save all your settings in seconds with the Import and Export wizard you only ever have to do it once, even across installations. Here are some of my favourites that I always remap:

ALT+Q - Insert Snippet
A hang over I have from QuickCode.NET). It's just easier.

ALT+S - View.ShowSmartTag
This is invaluable, you know that little smart tag that appears over your code when you don't have a namespace imported? View.ShowSmartTag opens that dropdown if you have the cursor over it, thus, ALT+S - Enter will import the namespace automatically for you.

CTRL+S - File.SaveAll
I remap the control + S shortcut to SaveAll because I instinctively jump around my code hitting CTRL+S to save, this way, everything gets saved at once and I've not lost any code since.

I've got loads of others that I remap but if you haven't already, spend some time in the options, there's stuff in there that could save you hours of work in the long run.

2) This one is a real life saver if you are developing an application with multiple entry points, such as client-server architectures. But if you just dont know it's there then you aren't using it. Number 2 is: launching multiple programs  with debug at the same time. I used many different ways around this before I realised it was there. I'm not sure whether the feature was added fairly recently (2005 maybe?), or whether it's just always been there and I never used it. Anyway I've been using it now for years in one place or another. If you have a project of any real size, you are almost certainly running more than one assembly. For those who don't know, Right Click your Solution root node and select "Set Startup Projects..."

In the following dialog simply pick "Multiple startup projects" and set the action to "Start" for all the applications you want to run with debugging.

1) Prematurely ending a build if a project in the solution failed. If you have a full release of Visual Studio (i.e. not Express or Game Studio) you have access to the Macros editor on the Tools menu. From here, in the default EnvironmentEvents VB module add the following code, save, and exit the macros editor.

    Private Sub BuildEvents_OnBuildProjConfigDone(ByVal Project As String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal SolutionConfig As String, ByVal Success As Boolean) Handles BuildEvents.OnBuildProjConfigDone
        If Not Success Then
        End If
    End Sub

The code above will kill the build if a project fails. Meaning you don't have to wait for the rest of the projects to fail before you can dig in and fix the problem. Useful!

Hopefully these little tips will help a few of you out there get a just a little bit more out of what is an absolutely fantastic editing package. Please drop me a comment if you find any of this useful, as I'd like to know whether to write more on related topics.
Rob - Null City Admin
By RobHutchinson on 03rd May 2009 @ 10:20PM
Coefficient.Sapphire is a Microsoft .NET 3.5 generator library supporting a variety of text generation methods. It supports text generated through a tree of mechanisms to produce a semi-random generated output.

This library is useful for generating all kinds of random text, an example of this might be the name of a character, or a random sentence through the use of a Markov Chain, or the name and properties of a random loot item in a game. Coefficient.Sapphire can attribute property modifiers to words in order to produce not only the name of items/npcs in a game, but also their stats.

Here is the library used in a game I wrote a while back to generate the Name, Level and Attributes of all items at random:

Each of the words hold meaning. For example the word "slow" may adjust agility -2 points and likewise "turtle" may increase armour +3. Flags can also be gleaned from the attributes returned by generation. So for example, the word "dagger" can flag "type" = "dagger" which can then be used to give the item an icon and imbue the item with the properties of a dagger type weapon. In a game with loot or random NPCs this kind of generator could add lastability to the game and reduce the amount of work required building a database of entities for the user to interact with. In the same application, the library was also used to produce random names for characters. Here are some of the names it will generate with a decent set of sub-data:


Everything within the system can be generated directly from a generator XML file or with the library objects programmatically.


File: Coefficient.Sapphire.zip (101.47 KB) - Version: 1.0
Icon Image Last Updated: Sunday, 15 May 2011 08:37:35
MD5: 9825F7E33EDA981DDCD56A8A7B96A8C5
SHA1: 92B87ECA3B8F29788959BDEE596C08420AF4E9F
Null City Software
Null City is dedicated to developing top quality sofware products for Windows PC, XBox and Windows Phone. We specialise in games and .NET applications & components.