Search Tools Links Login

Taking advantage of the Templates folder for VB


Visual Basic 6, or VB Classic

Article to show those who do not know about the Templates folder for VB how to save templates to it for future use.

Original Author: Clint LaFever

Code

Taking advantage of the Templates
folder for VB


In newsgroups I have seen the question asked a
lot about how to change the default properties of the form when you add new
forms to a project.  With how much this question is asked I figured if they
just did a search in the newsgroup they would find the answer without having to
ask again (but that is a different story).  Anyhow, I decided to post this
here to help all the newbies out there and so I can use this link in my
responses to the newsgroups questions.


So, how many times have you started a new project
and found yourself putting in the same old common code you always use in every
project.  Some people will just point to a common location that they saved
this code to, others will use an Add-In that stores reusable code to insert it,
and so forth.  For the most part all of us have some set of code that we
always want and need in every project.  So others always work with
databases and always need to reference ADO, DAO etc.  Others have a preferred
font setting for all forms.  Well, the simple way to deal with this is to
take advantage of the Templates folder found in where you installed VB. 
For me that is D:Program FilesMicrosoft Visual StudioVB98Template.  If
you go to your folder location you will see this folder contains sub folders for
templates like:



  • Classes

  • Code

  • Controls

  • Forms

  • MDIForms

  • Menus

  • Projects

  • Proppage

  • Userctls

  • Userdocs


Now the smart ones out there who never saw this
before may be catching on already.  Ok, now let me show you how to use this
for making a Project Template.



  1. Open VB.  Start a new
      standard exe project.

  2. Add all the modules, classes,
      forms, references, components, etc that you need

  3. You may even consider setting
      some project properties like Copyright etc.

  4. Make sure you have all your
      modules and forms good meaningful names as to not overwrite any other files
      later (you will see).  As for the Project Name, save it with a nice English
      like file name.

  5. Now save ALL these files to D:Program FilesMicrosoft Visual StudioVB98TemplateProjects
      (note to use your path not mine)

  6. Close VB.

  7. Open VB.


Now you should see that project as an option of a
template for starting a new project.  Choose it to start your new project
and presto, you have ALL your code, and property settings all in place. 
Easy huh.



  1. Now, go ahead and start just a
      standard EXE project.  

  2. On the that basic first form,
      set it up with all the properties you like using for all your forms. 
      Now save
    JUST THAT FORM
      to D:Program FilesMicrosoft Visual StudioVB98TemplateForms (remember,
      use meaningful names and not to overwrite existing templates
    .)

  3. Close VB.

  4. Open VB.

  5. Start a new project form you
      nice new template.

  6. Click your toolbar to add a
      new form.


Your new template of a form is now an option of
one to add.


Why settle for the default when you can have it
your way.  I think you can see what you can do now, if not, think about
another profession.  Just kidding.  I hope this helps everyone who did
not know about this.  I just find it so easy to be able to start a new
project and have all the references, components, and code I always use and need
already there.


-Clint LaFever

lafeverc@hotmail.com


http://vbasic.iscool.net





 


 


 


 


About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 78 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.