Click here to Skip to main content
15,791,963 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi all,
I have two winform applications that i will call them Prog1 and Prog2.

In Prog2 i have a form contains of a gridview and a panel next to it. When each row of the grid become activated, Prog1 (based on information of that activated row) should run in the panel.

Someone tells me, it can be done by creating an ActiveX control of my Prog1 !? Now i want to know if it is possible and also how can i do that?

Note: I have found in my lots of searches how can i create an activex control by class library project but i do not know how can i link it to my .exe application (Prog1).

Edit: Indeed, my two winform apps work like below:
1) First user select one row of the grid in Prog2 and then press a button that runs Prog1 for this selected row.

2) Prog1 has a design panel, allows user to draw a diagram and then save it.(What is important here is that Prog1 saves the data of the drawn diagram just in database but not as a file.)

3) These two steps is repeated for all of rows of the grid.

4) The problem is in this step, when the user select a row of the grid and he wants to see just a preview of its related diagram,in the panel next to the grid, without opening design area (I mean Prog1).That is what i want exactly...
Updated 8-Oct-13 21:42pm
Sergey Alexandrovich Kryukov 9-Oct-13 2:09am    
Why? why?!
bryce 9-Oct-13 2:18am    
sounds like homework/class exercises to me
Sergey Alexandrovich Kryukov 9-Oct-13 2:22am    
ActiveX in Forms? If this is a homework, that teacher wants to waste student's time...

1 solution

Yes, you can create one Singleton COM (no need for it to be ActiveX) object to serve as a mechanism for sending messages from one application to the other. But it will require more effort than using some other standard inter-process communications infrastructures already available in Windows/.Net.

Here (MSDN[^]) are listed some of them. It also requires some effort to implement, but .Net Remoting also serves the purpose and implements a mechanism which allows you to 'abstract' yourself from the exact 'location' of the objects (can be in the same or different AppDomain or even in different computers). If looking for something more evolved you can take a look at WCF, you can find a tutorial about it in WCF: From a Beginner's perspective & a Tutorial[^] and here From .NET Remoting to the Windows Communication Foundation (WCF)[^].

Edit: Now, from your comments and edit. Create one shared library (DLL) and put there all classes needed for edition and previsualization, now that functionality can be referenced and used from both applications (prog1, prog2).

Share this answer
M_Mogharrabi 9-Oct-13 3:19am    
Hi V.Lorz, I think your shared library solution can be my answer.I will try it and write back the result. Thanks a lot.
M_Mogharrabi 28-Jan-14 4:57am    
Thanks V.Lorz,that was my answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900