15 December, 2011

Tips and Tricks: Clipboard Ring and Toolbox Snippets

Introduction

Today I show you my favorite future in visual studio which is Clipboard Rind and Toolbox Snippets.

Problem:


Copy same code in multiple place.


Solution:


Temporary store small peace of code.


There are two future in visual studio


1. Clipboard Ring
2.Toolbox Snippets

1.    Clipboard Ring

Many times I wish I could go back to something I copied & pasted just a few minutes ago, then to have to go and copy the same text all over again. Turns out that Visual Studio already has this “hidden” feature.  It’s called the Clipboard Ring

If you copy a number of items to the clipboard, pressing [Ctrl] + [Shift] + [V] will paste the last text that was copied, but it will also highlight the pasted phrase.

Continue holding down [Ctrl] + [Shift] and press [V] again.  This will cause that highlighted section to cycle through the other items on the clipboard.  This is extremely useful when you have to copy multiple lines of separate text to a new document. 

You can also use [Ctrl] + [Shift] + [Insert] keys instead of [Ctrl] + [Shift] + [V]

2.     Toolbox Snippets

Now, you might be saying, “Great, but what if I want to save a piece of code that I use frequently in multiple places? It means same pieces of code change in multiple files. I don’t want to have to cycle through the clipboard ring every time.”  Well, there’s also a feature for that

If you highlight a section of code (or text) and drag it to the Toolbox, VS will create a "snippet” (not to be confused with code snippets). When u want back that code then you dragged into the VS editor or double click on that snippet it will paste in VS editor.

And last but not least these snippets also available in next day.

Screen Sot