Solved

Sharing a Class between two executables

Posted on 2013-06-01
4
226 Views
Last Modified: 2013-06-03
Hello,
I have an executable PROJ001.exe  which creates a global class called "RBSTrans" which allows all of the forms within this project to have access to the same instance of this class. PROJ001 now needs to call a number of new executables (ie PROJ002, PROJ002, PROJ003 etc...) . How can I make the instance of class RBSTrans available to these new projects (executables). An example would be great.

regards
Pat
0
Comment
Question by:pclarke7
  • 2
  • 2
4 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 39212963
I'm not sure I understand your environment, but if PROJ001.exe is a .NET executable, then you can add a reference to that assembly in each of your other applications. As long as the relevant classes are declared public, then you can create instances of this class in those other applications.
0
 

Author Comment

by:pclarke7
ID: 39213266
Thanks for that,
how do I add a reference to PROJ001.exe in PROJ002 and if PROJ001.exe already has an instance of my public Class , can PROJ002 reference the same instance ?

regards
Pat
0
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39216109
how do I add a reference to PROJ001.exe in PROJ002
Within Visual Studio, right-click your PROJ002 project within Solution Explorer and select "Add Reference."

if PROJ001.exe already has an instance of my public Class , can PROJ002 reference the same instance ?
Now you are talking about working across process boundaries. This is not possible. You would need to set up some kind of inter-process communication (e.g. pipes, files, shared memory, remoting, etc.) in order to share data between processes.
0
 

Author Closing Comment

by:pclarke7
ID: 39217031
Thanks for your help Kaufmed, based on this answer I will swap over to DLL

regards
Pat
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now