VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Taking advantage of the Templates folder for VB

by Clint LaFever (19 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (10 Votes)

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

Rate Taking advantage of the Templates folder for VB

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 Files\Microsoft Visual Studio\VB98\Template.  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.  
  3. Add all the modules, classes,
      forms, references, components, etc that you need

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

  6.  
  7. 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.

  8.  
  9. Now save ALL these files to D:\Program Files\Microsoft Visual Studio\VB98\Template\Projects
      (note to use your path not mine)

  10.  
  11. Close VB.

  12.  
  13. 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.  
  3. 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 Files\Microsoft Visual Studio\VB98\Template\Forms (remember,
      use meaningful names and not to overwrite existing templates
    .)

  4.  
  5. Close VB.

  6.  
  7. Open VB.

  8.  
  9. Start a new project form you
      nice new template.

  10.  
  11. 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

[email protected]


http://vbasic.iscool.net





 


 


 


 


Download this snippet    Add to My Saved Code

Taking advantage of the Templates folder for VB Comments

No comments have been posted about Taking advantage of the Templates folder for VB. Why not be the first to post a comment about Taking advantage of the Templates folder for VB.

Post your comment

Subject:
Message:
0/1000 characters