Home All Groups Group Topic Archive Search About

Best way to build a Code Library

Author
27 Jul 2005 2:53 PM
Kahuna
Hi Folks

In Access I have one mdb which is where I store all my re-usable code and
forms / reports etc. I tend to either cut and paste from there, import or
just link / reference that mdb in my built apps.

Whats the best way to store this kind of stuff in VB6. Theres probably a
tool in there somewhere already but I dont have the documentation with me at
present and the MSDN seems unfathomable as a look-up source?

Appreciate any feedback.

--
Cheers

------------------------
Kahuna
------------------------

Author
27 Jul 2005 3:40 PM
Ken Halter
Show quote Hide quote
"Kahuna" <n***@gonewest.com> wrote in message
news:e3jG1rrkFHA.2472@TK2MSFTNGP15.phx.gbl...
> Hi Folks
>
> In Access I have one mdb which is where I store all my re-usable code and
> forms / reports etc. I tend to either cut and paste from there, import or
> just link / reference that mdb in my built apps.
>
> Whats the best way to store this kind of stuff in VB6. Theres probably a
> tool in there somewhere already but I dont have the documentation with me
> at present and the MSDN seems unfathomable as a look-up source?
>
> Appreciate any feedback.
>
> --
> Cheers
>
> ------------------------
> Kahuna
> ------------------------

There's nothing built into VB that would allow you to store "snips".

My absolute favorite 3rd party tool for this is Source+ 2000
http://www.axtools.com/products/sourceplus.htm

Also, their CodeSMART add-in has this functionality built in (CodeSMART's a
"must have" too)

There are dozens of similar utilities. You can most likely get one that's
free and includes the source at PlanetSourceCode.com

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..
Author
27 Jul 2005 4:43 PM
Kahuna
Show quote Hide quote
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:eejmzFskFHA.1244@TK2MSFTNGP10.phx.gbl...
> "Kahuna" <n***@gonewest.com> wrote in message
> news:e3jG1rrkFHA.2472@TK2MSFTNGP15.phx.gbl...
>> Hi Folks
>>
>> In Access I have one mdb which is where I store all my re-usable code and
>> forms / reports etc. I tend to either cut and paste from there, import or
>> just link / reference that mdb in my built apps.
>>
>> Whats the best way to store this kind of stuff in VB6. Theres probably a
>> tool in there somewhere already but I dont have the documentation with me
>> at present and the MSDN seems unfathomable as a look-up source?
>>
>> Appreciate any feedback.
>>
>> --
>> Cheers
>>
>> ------------------------
>> Kahuna
>> ------------------------
>
> There's nothing built into VB that would allow you to store "snips".
>
> My absolute favorite 3rd party tool for this is Source+ 2000
> http://www.axtools.com/products/sourceplus.htm
>
> Also, their CodeSMART add-in has this functionality built in (CodeSMART's
> a "must have" too)
>
> There are dozens of similar utilities. You can most likely get one that's
> free and includes the source at PlanetSourceCode.com
>
> --
> Ken Halter - MS-MVP-VB - http://www.vbsight.com
> DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
> Please keep all discussions in the groups..
Cheers Ken - I'll check those out ASAP

--
Cheers
________
Kahuna
________
Author
27 Jul 2005 5:28 PM
Mike D Sutton
> In Access I have one mdb which is where I store all my re-usable code and
> forms / reports etc. I tend to either cut and paste from there, import or
> just link / reference that mdb in my built apps.
>
> Whats the best way to store this kind of stuff in VB6. Theres probably a
> tool in there somewhere already but I dont have the documentation with me at
> present and the MSDN seems unfathomable as a look-up source?

The best type of reusable code is the generic kind that can simply be dropped into a class (.cls) or code (.bas) module.
These can simply be added to the application at design time and you have all the functionality at your fingertips rather
than having to copy and paste code segments all the time.  If you find this happening often then it usually means
there's a common solution to whatever you're doing, code it up into a generic library then simply import that each time
you require the functionality.
Hope this helps,

    Mike


- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/
Author
27 Jul 2005 5:34 PM
Kahuna
Show quote Hide quote
"Mike D Sutton" <ED***@mvps.org> wrote in message
news:%23%23fCPCtkFHA.3580@TK2MSFTNGP09.phx.gbl...
>> In Access I have one mdb which is where I store all my re-usable code and
>> forms / reports etc. I tend to either cut and paste from there, import or
>> just link / reference that mdb in my built apps.
>>
>> Whats the best way to store this kind of stuff in VB6. Theres probably a
>> tool in there somewhere already but I dont have the documentation with me
>> at
>> present and the MSDN seems unfathomable as a look-up source?
>
> The best type of reusable code is the generic kind that can simply be
> dropped into a class (.cls) or code (.bas) module.
> These can simply be added to the application at design time and you have
> all the functionality at your fingertips rather
> than having to copy and paste code segments all the time.  If you find
> this happening often then it usually means
> there's a common solution to whatever you're doing, code it up into a
> generic library then simply import that each time
> you require the functionality.
> Hope this helps,
>
>    Mike
>
>
> - Microsoft Visual Basic MVP -
> E-Mail: ED***@mvps.org
> WWW: Http://EDais.mvps.org/
>
Thanks Mike - I try to avoid using libraries as much as possible (because of
compatibility issues - though I solved those in Access using SageKey
scripts) - so would like to be able to store the code etc and just import /
paste it in from a source. Looking at software already available there are
quite a few products with fairly sofisticated interfaces. Wonder what others
use though?

--
Cheers
________
Kahuna
________
Author
27 Jul 2005 5:51 PM
Mike D Sutton
> Thanks Mike - I try to avoid using libraries as much as possible (because of
> compatibility issues - though I solved those in Access using SageKey
> scripts) - so would like to be able to store the code etc and just import /
> paste it in from a source. Looking at software already available there are
> quite a few products with fairly sofisticated interfaces. Wonder what others
> use though?

What compatibility issues?  VB6 isn't going to become incompatible with itself, ever :)
In fact, code libraries make compatibility issues easier - If all the version specific stuff is wrapped up in a class
then your application doesn't need to worry about which code to use for which version, it just swaps out the class for
another version and suddenly the code works.  I recently helped a client (an Access developer actually) write a generic
code library for working between ADO/DAO/SQL server databases generically; just swap in a different class, change the
construction code (literally setting a couple of platform specific properties on the object) and suddenly it connects to
a whole different data source.
Since his application is built on top of this framework it doesn't care about what data source it's using, it just works
and with a little UI he can even change the data source at runtime!  Try that with little code snippets, the application
would be an absolute mess with a bazillion if's or select case's rather than just concentrating on the business logic.
Lots of code duplication is more often than not a sign of bad application design..
Hope this helps,

    Mike


- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/
Author
27 Jul 2005 6:20 PM
Kahuna
Show quote Hide quote
"Mike D Sutton" <ED***@mvps.org> wrote in message
news:OefeMPtkFHA.1412@TK2MSFTNGP09.phx.gbl...
>
> What compatibility issues?  VB6 isn't going to become incompatible with
> itself, ever :)
> In fact, code libraries make compatibility issues easier - If all the
> version specific stuff is wrapped up in a class
> then your application doesn't need to worry about which code to use for
> which version, it just swaps out the class for
> another version and suddenly the code works.  I recently helped a client
> (an Access developer actually) write a generic
> code library for working between ADO/DAO/SQL server databases generically;
> just swap in a different class, change the
> construction code (literally setting a couple of platform specific
> properties on the object) and suddenly it connects to
> a whole different data source.
> Since his application is built on top of this framework it doesn't care
> about what data source it's using, it just works
> and with a little UI he can even change the data source at runtime!  Try
> that with little code snippets, the application
> would be an absolute mess with a bazillion if's or select case's rather
> than just concentrating on the business logic.
> Lots of code duplication is more often than not a sign of bad application
> design..
> Hope this helps,
>
>    Mike
As I said Mike - just getting into this so the feedback is very welcome. A
database of code and objects is very appealing though, and of course, I'll
be trying my hand a building the DLL's for very common code too.

--
Cheers
________
Kahuna
________
Author
27 Jul 2005 5:40 PM
Jim Edgar
"Kahuna" <n***@gonewest.com> wrote in message
news:e3jG1rrkFHA.2472@TK2MSFTNGP15.phx.gbl...
> Hi Folks
>
> In Access I have one mdb which is where I store all my re-usable code and
> forms / reports etc. I tend to either cut and paste from there, import or
> just link / reference that mdb in my built apps.
>
> Whats the best way to store this kind of stuff in VB6. Theres probably a
> tool in there somewhere already but I dont have the documentation with me
at
> present and the MSDN seems unfathomable as a look-up source?
>

MZ Tools allows you to save code templates.  You might look into it unless
you have a huge code library.  It's one of the many things MZ tools does
well.

Jim Edgar
Author
27 Jul 2005 6:43 PM
Ralph
Show quote Hide quote
"Kahuna" <n***@gonewest.com> wrote in message
news:e3jG1rrkFHA.2472@TK2MSFTNGP15.phx.gbl...
> Hi Folks
>
> In Access I have one mdb which is where I store all my re-usable code and
> forms / reports etc. I tend to either cut and paste from there, import or
> just link / reference that mdb in my built apps.
>
> Whats the best way to store this kind of stuff in VB6. Theres probably a
> tool in there somewhere already but I dont have the documentation with me
at
> present and the MSDN seems unfathomable as a look-up source?
>
> Appreciate any feedback.
>
> --
> Cheers
>
> ------------------------
> Kahuna
> ------------------------
>

In addition to the other's sage advice, you might look into one of VB6's
often used (but little known) interesting feature of Project Templates and
Wizards.

You can create generic, 'ranson note', VB Projects so when you request a new
project one can be loaded with most of the items you may use. It is a simple
matter to later delete anything you don't use. As you become more
comfortable with the Wizard add-in you can create "Steps" to include or
exclude items.

You can also add templates/wizards to the Project "Add..." menu to load
different classes, modules, controls, and forms. A process that will grow
alarmingly once you get the hang of it. <g>

Another useful utility is MZTools (http://www.mztools.com/v3/download.htm).
It not only can store and 'paste' template code, but can intercede and allow
you to rename elements while a wizard is creating them.

Combine all the above with VSS to back up and store your templates. (Create
a project/s from the ..\VB98\Template folder) and you can create a very
sophisticated development environment. One that is also easily shared by
multiple developers in a corporate environment and carried around. (Place
VSS on a CD.)

However, there is one warning I must add, once you create such an
environment it is tough to leave it behind. My biggest problem in moving to
..NET has not been the language or conceptual differences - it has been
leaving all my toys behind. The VS.Net environment is just as ammendable but
it still takes time to rewire all that stuff, both in code and mentally. <g>

-ralph