One of the things I really like about teaching technical classes is getting to know and talk with students, learning of the challenges they face and how they've addressed them. Frequently, I can learn from their experiences, too. So, it works out well for both student and instructor.
In a custom Visual Studio/SQL Server class last week, I made a passing comment about Visual Studio being a very good text editor, but that it lacked one feature that I really like in other editors - block copy and paste. I lamented that the Visual Studio editor doesn't allow you to select a rectangular area of code and then copy and paste it elsewhere in the document. Other editors that I've used over the years - emacs, vim, Notepad++, UltraEdit - can do that. I would have thought that Microsoft would have put that in Visual Studio.
It turns out that they did. One of my students showed me an old Microsoft Word trick. You can depress the Alt key while using the left mouse button to select rectangular areas of code. Pressing the Alt key tells the editor not to select the entire line, but to follow the mouse pointer wherever it goes. Then you can use normal techniques to copy the text and paste it wherever you'd like.
Why is this useful? Consider declaring a bunch of variables as show above. At a later point in your coding, you need to set the value of all of these variable. By copying the block you can quickly and easily paste only the relevant text (the variable names) into the procedure like so.
Pretty nifty! Thanks, Ellen, for the tip!
By the way, this technique works in the SQL Server Management Studio editor, too.
Cheers!
Joe