• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Sharing a Class between two executables

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
pclarke7
Asked:
pclarke7
  • 2
  • 2
1 Solution
 
käµfm³d 👽Commented:
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
 
pclarke7Author Commented:
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
 
käµfm³d 👽Commented:
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
 
pclarke7Author Commented:
Thanks for your help Kaufmed, based on this answer I will swap over to DLL

regards
Pat
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now