Search code examples
c#winformsinterprocess

Two WinForms applications


I have 2 different C# programs, both of them contain a form application.

How can I run both these 2 programs in one of them?

I added, using the existing project option, progr1 in program 2.
Now I want to run program2.
When program 2 runs and it pops up the form application I want to also activate (automatically) program 1 and the form application from this project to also pop up.

I would also want to have access to all the methods from one program in the other one.

Thanks for your help.


Solution

  • If they are indeed separate processes, then you need to look at Inter Process Communication. There are a bunch of different options for doing this, personally, I'd look at WCF to talk in between applications.

    But that assumes that these are separate processes. Another thing you might consider is just having one process that launches multiple windows. In this case, you can easily pass references to each window across and call methods and properties from the other one.