Home All Groups Group Topic Archive Search About

re-use code for multiple applications

Author
10 Mar 2006 9:30 PM
Sue
Hi,

I have a sql server database enterprise database, v. 8. I have multiple
visual basic applications connecting to this database -- the apps have
to be individual they cannot be all combined into one. I would like to
re-use some of the code for all the applications including the code for
creating the adodb connection to the database, verifying users and some
other initial validations that are common to all the applications when
they start up. As of now the code resides in a global module but when I
copy and paste the global module to the other applications there is
more work to be done because sometimes variable names  are different in
each application, example one application may have Public sqlConnection
As New ADODB.Connection in its global module while another application
will call the same connection as Public myDB As New ADODB.Connection.
So how can I re-use the common functions and variables with minimum
changes in all applications? Should I use class or activex control? Any
examples or samples on the web that I can look at will also help.

Thank you very much for taking the time to answer the questions.

Author
10 Mar 2006 11:33 PM
Michael C
Show quote Hide quote
"Sue" <sea_***@hotmail.com> wrote in message
news:1142026236.307635.295090@i40g2000cwc.googlegroups.com...
> Hi,
>
> I have a sql server database enterprise database, v. 8. I have multiple
> visual basic applications connecting to this database -- the apps have
> to be individual they cannot be all combined into one. I would like to
> re-use some of the code for all the applications including the code for
> creating the adodb connection to the database, verifying users and some
> other initial validations that are common to all the applications when
> they start up. As of now the code resides in a global module but when I
> copy and paste the global module to the other applications there is
> more work to be done because sometimes variable names  are different in
> each application, example one application may have Public sqlConnection
> As New ADODB.Connection in its global module while another application
> will call the same connection as Public myDB As New ADODB.Connection.
> So how can I re-use the common functions and variables with minimum
> changes in all applications? Should I use class or activex control? Any
> examples or samples on the web that I can look at will also help.
>
> Thank you very much for taking the time to answer the questions.

Create an activeX dll and move all the code into a class module in the dll.
If you make it Global Multi Use it will act like a module but it might not
be the best way to do it. I'd suggest renaming everything in your app that
relates to this code as you'll find it is suprisingly quick to do. Just
rename the relevant variable/property/function and push ctrl-f5 to find the
problems.

Michael
Author
10 Mar 2006 11:51 PM
ralph
Show quote Hide quote
"Sue" wrote:

> Hi,
>
> I have a sql server database enterprise database, v. 8. I have multiple
> visual basic applications connecting to this database -- the apps have
> to be individual they cannot be all combined into one. I would like to
> re-use some of the code for all the applications including the code for
> creating the adodb connection to the database, verifying users and some
> other initial validations that are common to all the applications when
> they start up. As of now the code resides in a global module but when I
> copy and paste the global module to the other applications there is
> more work to be done because sometimes variable names  are different in
> each application, example one application may have Public sqlConnection
> As New ADODB.Connection in its global module while another application
> will call the same connection as Public myDB As New ADODB.Connection.
> So how can I re-use the common functions and variables with minimum
> changes in all applications? Should I use class or activex control? Any
> examples or samples on the web that I can look at will also help.
>
> Thank you very much for taking the time to answer the questions.
>


Michael C's suggestion is one way.

I would consider creating ActiveX Dlls and then utilize MTS (COM+) for your
middle layer.

Show quoteHide quote
"Horses for courses" <g>
-ralph