Deborah's Developer MindScape

         Tips and Techniques for Web and .NET developers.

October 29, 2009

Visual Studio: Clipboard Ring

Filed under: C#,VB.NET,Visual Studio @ 7:35 pm

Way back when we were using Visual Studio 2005, there was a Clipboard Ring tab in the Toolbox. I loved  that tab!

When I am doing a bunch of copy/pastes, I sometimes find that I hit Ctrl+C when I meant to hit Ctrl+V, and poof! my Clipboard was kindly wiped out for me.

With VS 2005, I could just open that Clipboard Ring tab of the Toolbox and there it would be … the last several sets of Clipboard contents just waiting for me to reuse.

I was bummed when I did not see this feature in VS 2008. But behold, there are alternatives.

Accessing the Internal Clipboard Ring

Visual Studio still keeps the last sets of items you copied to the Clipboard. I heard the number was 20: that it keeps the contents from the last 20 times you used the copy function. But I did not test out  that limit.

You can no longer see these last 20 clipboard items, but you can access them using keystrokes:


Keep holding down the Ctrl+Shift and pressing V to loop through the last set of clipboard items until you find the one you want.

This has saved me much frustration, knowing I can get back to my prior Clipboard contents.

Using the Toolbox

When you are using a code editor, the Toolbox displays a General tab. You can copy and paste or drag and drop code to this tab. This allows you to readily access these bits of code any time you are in a code editor.

Say I have a standard Try/Catch block that I want to use in several methods. If I plan to reuse this code often, I could create a code snippet as described here. But in this case, I just want to use this code today while I am doing some editing.

So I write the code I want, and drag it onto the General tab of the toolbox. It looks like this:


NOTE: I dragged some VB code, but this works the same in C#. It even allows me  to have both VB and C# code on this tab at the same time.

If I hover over the entry, I can see the complete set of code as follows:


I can also rename the entry if  I want to give it a name I can more readily recognize:


Note, however, that if the entry is renamed, hovering over  the entry displays the name and not the set of code that the name represents.

I can then copy and paste from the toolbox, or just drag and drop the entry into the code editor.

If I want to manage a large set of these, I can add additional tabs to the toolbox and organize these pieces of code however I want.

If you are presenting or training, this technique is good for keeping longer code pieces so that your attendees don’t need to watch you type quite so much.


RSS feed for comments on this post. TrackBack URI

Leave a comment

© 2019 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs