473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Standard Include Files

In my vb6 apps I have a set of standard modules that I include in all of my applications. However, when I upgrade an existing application it creates a copy of these modules in the application directory. The problem is that I can't move these files to a standard location and then point all my apps to this location. I've looked on different newsgroups and the closest solution I have found is to use inheritance. This solution works for using a standard form over and over again, but does not seem to work well when you have standard modules that you are wanting to use over and over again. Any suggestions?
Nov 20 '05 #1
14 1260
why not put all these classes/modules in a dll and reference to that dll in
all your applications?

dominique
"mike" <an*******@discussions.microsoft.com> wrote in message
news:0A**********************************@microsof t.com...
In my vb6 apps I have a set of standard modules that I include in all of

my applications. However, when I upgrade an existing application it creates
a copy of these modules in the application directory. The problem is that I
can't move these files to a standard location and then point all my apps to
this location. I've looked on different newsgroups and the closest solution
I have found is to use inheritance. This solution works for using a
standard form over and over again, but does not seem to work well when you
have standard modules that you are wanting to use over and over again. Any
suggestions?
Nov 20 '05 #2
Ok, I have tried that and I am getting a compilation error on the following line of code
Public Sub ConnectDB(ByRef DBName As String, ByRef ADOControl As VB6.ADODC, Optional ByRef UseDefault As Boolean = True, Optional ByRef ReadOnly_Renamed As Boolean = False, Optional ByRef RSLock As ADODB.LockTypeEnum = ADODB.LockTypeEnum.adLockOptimistic

The compiler doesn't like the vb6.adodc reference. When I upgrade an entire project it doesn't have a problem with this reference. Any suggestions

Nov 20 '05 #3
* "=?Utf-8?B?bWlrZQ==?=" <an*******@discussions.microsoft.com> scripsit:
In my vb6 apps I have a set of standard modules that I include in all
of my applications. However, when I upgrade an existing application it
creates a copy of these modules in the application directory. The
problem is that I can't move these files to a standard location and then
point all my apps to this location. I've looked on different newsgroups
and the closest solution I have found is to use inheritance. This
solution works for using a standard form over and over again, but does
not seem to work well when you have standard modules that you are
wanting to use over and over again. Any suggestions?


I would create a class library that includes these methods and reference
the class library from your EXE projects.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Ok, I was able to put them all into a dll. The program still doesn't recognize the functions. Do I need to reference the code in the applications a specific way?
Nov 20 '05 #5
add reference to that dll (for example via menu: project -> add reference)

your classes will also be in a different namespace...
dominique

"mike" <an*******@discussions.microsoft.com> wrote in message
news:D4**********************************@microsof t.com...
Ok, I was able to put them all into a dll. The program still doesn't

recognize the functions. Do I need to reference the code in the
applications a specific way?
Nov 20 '05 #6
Mike,
As Dominique stated, move the "common" code to its own assembly and
reference this assembly.

Remember however to reference all the same assemblies that the upgrade
wizard added. Specifically Microsoft.VisualBasic.Compatibility.

However I would strongly recommend you Refactor (http://www.refactoring.com)
your "common" code to not require the Microsoft.VisualBasic.Compatibility
assembly, as this assembly is not installed by default.

An alternative to a separate assembly is to "Link" to the file, when you use
"Project - Add Existing Item" click the down arrow next to the Open button,
select "Link file".

Hope this helps
Jay

"mike" <an*******@discussions.microsoft.com> wrote in message
news:0A**********************************@microsof t.com...
In my vb6 apps I have a set of standard modules that I include in all of

my applications. However, when I upgrade an existing application it creates
a copy of these modules in the application directory. The problem is that I
can't move these files to a standard location and then point all my apps to
this location. I've looked on different newsgroups and the closest solution
I have found is to use inheritance. This solution works for using a
standard form over and over again, but does not seem to work well when you
have standard modules that you are wanting to use over and over again. Any
suggestions?
Nov 20 '05 #7
I put these files in a common assembly and add a reference to them in the project explorer. The program still doesn't recognize it. Am I not referencing it correctly?
Nov 20 '05 #8
don't forget to check the right namespace

for example, above your code add
imports TheNameOfTheImportedNamespace
dominique
"mike" <an*******@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
I put these files in a common assembly and add a reference to them in the

project explorer. The program still doesn't recognize it. Am I not
referencing it correctly?
Nov 20 '05 #9
* "=?Utf-8?B?bWlrZQ==?=" <an*******@discussions.microsoft.com> scripsit:
Ok, I was able to put them all into a dll. The program still doesn't
recognize the functions. Do I need to reference the code in the
applications a specific way?


In the EXE project, go to the solution explorer and select the project's
"References" folder. In its contextmenu, select "Add Reference..." and
select the DLL you created.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #10
Mike,
You need to be certain to put Public on every element that you want to
access from the second assembly. Also consider either Friend or Private for
elements that you don't want the second assembly to access.

Protected is useful for elements in base classes to be used by derived
classes.

I normally explicitly label elements as Public or Private rather then
relying on the defaults.

Hope this helps
Jay

"mike" <an*******@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
I put these files in a common assembly and add a reference to them in the

project explorer. The program still doesn't recognize it. Am I not
referencing it correctly?
Nov 20 '05 #11
All functions have the public reference. I have tried explicitly typing
imports <namespace name> in my code and it still doesn't recognize it.
Nov 20 '05 #12
All fuctions are public. I have tried manually typing imports<the
namespace> and this has not helped either. Any ideas?
Nov 20 '05 #13
Mike,
All functions have the public reference. What about the Class or Module the functions are in?

I stated ALL elements need to be Public where element is (Class, Module,
Enum, Interface, Sub, Function, Event, Property, etc...)

Hope this helps
Jay
"Mike Nettles" <Mi**********@doss.wiu.edu> wrote in message
news:eU**************@tk2msftngp13.phx.gbl... All functions have the public reference. I have tried explicitly typing
imports <namespace name> in my code and it still doesn't recognize it.

Nov 20 '05 #14
There was a combination of problems. I needed to change all my include files from modules to classes. This fixed the problem referencing the namespace. I'm new to dot net and I didn't realize I would have to specify the namespace as "imports <namespace.className>

Thanks for all the help.
Nov 20 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Web Developer | last post by:
Hi, In Java, the package java.lang.*; is automatically imported and provides a basic set of functionality. Questions: 1) In C++, are there any include files that are automatically included?...
3
by: Asfand Yar Qazi | last post by:
Hi, Here's the thing: the Eternity persistence system does not provide its own compilation phase for its source code: the programmer simply has to copy some files to his codebase. Here's the...
71
by: Christopher Benson-Manica | last post by:
At what point was the .h dropped from the STL headers? I just had a discussion yesterday with my boss, who said he wanted .h on all the STL includes, despite me protesting that it was not...
50
by: Konrad Palczynski | last post by:
I am looking for tool to validate conformity to defined coding standard. I have already found Parasoft's C++ Test, but it is quite expensive. Is there any Open Source alternative? I do not need...
11
by: BilfFord X | last post by:
If I # include "text.h" , where text.h consists of the following: # define NOTHING_IMPORTANT # include <stdio.h> , am I writing c++? cordially, bfx
2
by: sharpblade | last post by:
The title of these Item is "Make header files self-sufficient" There're two examples in this Item: Example 1: Dependent names. Templates are compiled at the point where they are defined, except...
7
by: Lighter | last post by:
Is overriding a function of a library in accordance with C++ standard? The following code are passed by the VS 2005 and Dev C++. #include <cstdlib> #include <iostream> using namespace std;...
6
by: Ole Nielsby | last post by:
The standard doesn't define this but what conventions do projects use? As I understand it, #include <somelibrary.h> is used for including system headers and those of frameworks such as...
270
by: jacob navia | last post by:
In my "Happy Christmas" message, I proposed a function to read a file into a RAM buffer and return that buffer or NULL if the file doesn't exist or some other error is found. It is interesting...
20
by: Peter Olcott | last post by:
Is there any standard C++ way to determine the size of a file before it is read?
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.