Monday, August 30, 2004

Changing the Form1

Ever get annoyed at all the work you have to do to change the "Form1" name on a new .NET project? Well if you didn't I did. There is a lot involved you have to go into the code and rename the class, then rename the constructor then rename the file itself, not really necessary but looks better.

Well after having had enough, and having nothing better to do, I decided to figure out how to change this. I have written wizards for VS.NET before , and I assume those reading this can learn that part on their own, so it is no mystery to me that allot of the wizards are nothing more than JavaScript's. Yes JavaScript's, though you would think MS would use VBScripts but that's one for the philosophers.

On to the point all the wizards have a file called Default.js, usually located in

"C:\progra~1\Microsoft Visual Studio .NET 2003\VC#\VC#Wizards\CSharpEXEWiz\Scripts\1033"

(Note:The language name and directory of the wizards not withstanding, and the wizard you want to modify.)

Inside this file you will find a function named "GetTargetName" or some variation depending on the language. Inside this file is the hard coded value "Form1". Here you can change it to whatever you want, myself I have frmMain, but it is a matter of personal preference I think.

No comments: