bpayne111 Posted October 22, 2003 Posted October 22, 2003 Just about everytime i create a new class i use the same 3 regions, Declarations, Properties, and Methods. I tried creating a macro to do this for me by letting it record my keystrokes. It worked ok but sometimes it screwed up and put stuff where it wasn't supposed to be. I know you can write macros using code... So how would i make a marco to do these regions for me using code? Thanks Brandon Quote i'm not lazy i'm just resting before i get tired.
*Experts* Volte Posted October 22, 2003 *Experts* Posted October 22, 2003 You could modify the file at: C:\Program Files\Microsoft Visual Studio .NET\Vb7\VBWizards\Class\Templates\1033\Class.vb which is the template for the New Class item, and change that. You can also add your own item templates, but it is a bit more work. There's probably some info in the MSDN about that. Quote
*Experts* Nerseus Posted October 22, 2003 *Experts* Posted October 22, 2003 You can also modify the template forms. There might be a way to add new templates, but I haven't looked. Using C# as an example, I changed the following file: C:\Program Files\Microsoft Visual Studio .NET 2003\VC#\VC#Wizards\CSharpAddWinFormWiz\Templates\1033\NewWinForm.cs Whenever I add a new form it uses this as the file. It does some fancy replacing so don't modify it too much. I removed most of the built in comments and added some regions, much like you're asking for. Plus a few more using statement (Imports in VB) that I use all the time. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
bpayne111 Posted October 22, 2003 Author Posted October 22, 2003 wow that's really cool, that would be much better than a macro any day...thanks for the good (and fast) response Quote i'm not lazy i'm just resting before i get tired.
*Experts* Nerseus Posted October 22, 2003 *Experts* Posted October 22, 2003 Forgot to mention, MAKE A COPY OF THAT FILE. You don't want to mess it up :) -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
bpayne111 Posted October 22, 2003 Author Posted October 22, 2003 WOW that is cool i just did it... so will this work if i say add a button to a form and copy the code? i'd like to hear some more details of how you guys used this to your advantage Quote i'm not lazy i'm just resting before i get tired.
*Experts* Volte Posted October 22, 2003 *Experts* Posted October 22, 2003 For something like that you should look into using Form Inheritance. It's sort of limited, but can be useful for making things like dialog boxes and such. Quote
bpayne111 Posted October 22, 2003 Author Posted October 22, 2003 yea i know about inheritance but then i can't edit the controls the way i want... if i had just one exit button on a form at load that i could play with (size and etc..) then i'd be happy Quote i'm not lazy i'm just resting before i get tired.
*Experts* Volte Posted October 22, 2003 *Experts* Posted October 22, 2003 That sounds like it would be quite feasible. In fact, I may look into this myself and write an article about it. I haven't written anything for Tutors Corner in awhile. Quote
bpayne111 Posted October 22, 2003 Author Posted October 22, 2003 let me know if you do.. i'd like to read it. thanks guys (ohh and yes i saved a copy before i saw your message ;)) Quote i'm not lazy i'm just resting before i get tired.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.