Wednesday, March 21, 2007

Copy and Paste in Visual Studio and MS SQL Server Managment Studio.

I realized that many people don’t know how easy VS 2005 allows us to copy, cut & paste. I’m sure that many of you know that but if you don’t, please give it try I’m sure that you’ll save some time.

Even my mother knows Ctrl-C, Ctrl-X, & Ctrl-V shortcuts to copy, cut, & paste. But do you know that you don’t need to select a line to copy/cut it. Just move cursor to the line you want to copy/cut and press Ctrl-C or Ctrl-X, the whole line will be in the clipboard.
We copied a line, now we can paste it. The line always will be posted above the line where you cursor is. And you cursor can be in any position on that line; I repeat ANY position of the line.
Do you know that you can cycle through the clipboard ring? Here’s the example where we going to swap ‘var1’ and ‘var2’ words:

public void foo()
{
  string s1 = "var1";
  string s2 = "var2"
}

First double click on word ‘var1’, to select it and then press Ctrl-C, to put the selection into the clipboard.
Next double click on word ‘var2 and press Ctrl-C again. Now we have both selections in the clipboard.
Now double click on word ‘var1’ again and replace it with ‘var2’ by pressing Ctrl-V. So far nothing new.
Last, double click on word ‘var2’ on the next line where we’re declaring variable s2 and press Ctrl-Shift-V twice (it means two times :) ).

2 comments:

Anonymous said...

I recall there used to be a toolbox panel that showed the contents of the clipboard ring that seems to have disappeared in VS 2005. You have any idea where that is?

Anonymous said...

Good post.