Solved

Sharing a Class between two executables

Posted on 2013-06-01
4
230 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 75

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 75

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 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