Multi-Project solution - how to show form from other project.

  • Thread starter Thread starter Gary Kahrau
  • Start date Start date
G

Gary Kahrau

If I create a solution that contains (2) projects.
ProjMain and Proj2.
Each project has a form1.

I want to press a button in ProjMain and show form1 of Proj2.

How do I do this?

Gary...
 
Gary Kahrau said:
If I create a solution that contains (2) projects.
ProjMain and Proj2.
Each project has a form1.

I want to press a button in ProjMain and show form1 of Proj2.

How do I do this?

You will have to add a reference to the other project (right-click the
project in project explorer, choose "Add reference..." from its context menu
and select the "Projects" tab). Notice that you cannot reference Windows
Forms Application projects. Instead, add the classes to class library
projects.
 
Herfried,

OK, I did what you said and added it as a class.
Proj3-ClassLibrary is now part of my ProjMain.

Now,
How do I display form1 that is contained within Proj3-ClassLibrary?

Thanks,
Gary...
 
you do it just like you would if it was part of the current project. Make a
reference to Proj3.Form1 and the call .show or .showdialog. Remember, the
form inside of proj3 is now just a class like any other class. It is the
exact same as using the system.windows.form class at this point, just has a
difference referenced path.

good luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top