Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Question sir,

I've created 2 different vs 2012 project, project1 and project2. How can I call the form from project1 that I want to use in project2? For example I want to use the form1 in project1 on a button on project2 .What should I do to call it?or what code do I use? Thank you in advance.
Posted
Updated 23-Sep-14 7:26am
v2

1 solution

During runtime, there is nothing like "project". There are only assemblies (one of the central points of .NET, by the way) and their modules. "Project" are left behind after you build you solutions.

If your assemblies participate in one application and, hence, their code is executed in one process, it does not present any special problem, which is reduced to a simple (and popular problem) of form collaboration: Pass data from a selected gridview row in form1 to a label or textbox in form2[^].

The only things is: all types and members you want to use across the boundary between assemblies, should be marked as public. In this case, development is no different from the development of a single monolithic project.

—SA
 
Share this answer
 
Comments
Migs.0 23-Sep-14 14:06pm    
Can I have a sample code sir. If you don't mind.
Sergey Alexandrovich Kryukov 23-Sep-14 14:35pm    
It would take time...
How about this: why won't you try by yourself and ask some follow-up questions if you fail. There is nothing difficult. Do you know how 1) define and implement interface? 2) write partial class definitions? 3) create an instance? 4) know how to call static and instance (non-static) methods/properties? That's all you need.
—SA

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