Cool .NET Tips and Tricks No.2
By Dr. Dexter Dotnetsky
Printer - Friendly Version
Dr. Dotnetsky
Dr. Dotnetsky

Well, It's Dr. Dotnetsky again! The fine people at eggheadcafe.com actually let back for a return visit (provided I'm on my best behavior) , with my second installment of Cool .NET Tips and Tricks!



First, a personal opinion

Dr. Dotnetsky is a firm believer in our First Amendment right to free speech. Recently we have seen some well-known Hollywood names who have abused the privileges and riches they've gained via our loyal purchases of movie tickets and patronage of their TV shows to use their positions as a platform for their anti-American left-wing anti - war garbage, right in the middle of a war when American soldiers, sailors and Marines are in harm's way and need our full support. Even after it became obvious we were incredibly successful in the war effort and had done the morally right thing, some of these yo-yo's continue to spout their junk! Dr. Dotnetsky wonders what the hell these morons are smoking out there in Tinseltown!

These people absolutely have a right to their views, but in my book, they don't have a right to abuse the positions they've attained to espouse them. If you are a Hollywood celebrity and you have strong anti-war views, you can always choose to run for political office in order to gain the legitimate platform to advance those views and influence the public.   And you know what? Together, we can take care of this problem real fast. Dr. Dotnetsky has a nice little list of actors and personalities on his "Iraq war political abusers list" and will make a continued effort for a very long period of time to make sure these Anti-American bastards don't ever again get the patronage that enabled them to spout this garbage.   I hope you will, too. That's the fastest way to get these bastards out of the picture!   And folks -- I ain't alone: check here.

Automated backup batch file with Winzip and wzzip

If you are like me, you probably work with other developers and your development code and projects are stored in Visual Sourcesafe or another source managment facility. But I've learned through painful experience that I shouldn't always trust the source control database as my only repository for my blood, sweat and tears (read: "Spaghetti code").

If you have Winzip (who doesn't...) they have a nice downloadable command-line utility called WZZIP. The following DOS batch file will enable you to make regular backups of everything in the folder it is run in and all subfolders, with the date and time appended to the "projectname" filename. Just replace "projectname" with whatever name you want to give your backup, and replace the "U:\" (a network share in my case) with the drive letter and folder where you want your ZIP copied and save the file with a ".bat" extension in your project's root folder. Nothing like that extra level of protection, eh?

for /F "tokens=1-4 delims=/- " %%a in ('date/T') do set CDATE=%%b%%c%%d
for /F "tokens=1-4 delims=:., " %%a in ('time/T') do set CTIME=%%a%%b%%c
wzzip -rPee projectname%CDATE%%CTIME% *.*
move projectname%CDATE%%CTIME%.zip U:\

Command Prompt here with Visual Studio.NET environment variables

The following registry script will provide you with a Windows Explorer context menu option for a Command Prompt. Right - click on any folder, choose "Command Prompt' and you'll get a DOS prompt with all the Visual Studio.NET environment variables set, enabling you to call the compilers, ILDASM, and all the other fine .NET tools! Just save the following with a ".reg" extension and double - click on the file.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\Command Prompt\Command]
@="Cmd.exe /k \"C:\\Program Files\\Microsoft Visual Studio .NET\\Common7\\Tools\\vsvars32.bat\" "

Cool Visual Studio.NET IDE shortcuts and tricks

VS.NET offers a huge number of shortcuts and tricks to make your development process easier. Most developers only learn a few of them. Here are some of my favorite goodies, plus a downloadable Excel worksheet at the bottom of my article with all of them conveniently arranged by category!

Full - Screen Editor:

When you are heads-down at the console writing code, its nice to be able to have the code editor window occupy the full screen and temporarily get rid of those nasty other windows. Just hit SHIFT ALT ENTER and presto - FULL SCREEN! Do it again to get right back to where you were.

Block code selection:

Just hold ALT and drag the cursor which creates a nice rectangular window to select a block of code!

Word wrap a line of code:

Isn't it annoying when you've typed a very long line of code because you're so creative and you are too lazy to break it up onto separate lines? Just hit CTRL R CTRL R and presto - VS.NET will wrap the line for you!

Clipboard Ring:

You can find the clipboard ring in its own section on the Toolbox. But you can also cycle through all the sucessive copies to the clipboard by simple typing CTRL SHIFT V over and over to see each one. Geez, I think this one ranks up there with the keychain beer can opener!

TaskList Shortcuts:

Just right click by the beginning line of your code section, choose "Add Task list shortcut", and your shortcut to the code will appear right in your task list! Just click on it in your Task List window to go instantly to the exact spot!

Bookmarks:

Hit CTRL K CTRL K to set a bookmark. Type CTRL K CTRL N or CTRL K CTRL P to find bookmarks in either direction.
I've got bookmarks everywhere now! Unfortunately, I'm having a Senior Moment and I can't remember how to undo them! Oh, well....

Back-Forward Navigation:

Type CTRL- or / CTRL SHIFT - (That's control shift hyphen). Easy to go back or forward to the last window you were in!

Custom Task List Tokens:

Go to Tools/Options/Environment/Task List where you can create your own Task List tokens and give them priorities. Man this is so cool, you can share these custom Tokens among your developer group and your productivity will soar!

Well, that's it for me today. See you soon again, I hope.


And finally, as promised, here is the Excel file with all the shortcuts, courtesy of the nice people at Microsoft:

Visual Studio.NET shortcuts

Dr. Dexter Dotnetsky is the alter-ego of the Eggheadcafe.com forums, where he often pitches in to help answer particularly difficult questions and make snide comments. Dr. Dotnetsky holds no certifications, and does not have a resume. Always the consummate gentleman, Dr. Dotnetsky can be reached at youbetcha@mindless.com.  Dr. Dotnetsky's motto: "If we were all meant to get along, there would be no people who wait for all the groceries to be rung up before starting to look for their damn checkbook."