Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Gary Kahrau
Guest
 
Posts: n/a
#1: Nov 21 '05
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...




Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#2: Nov 21 '05

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


"Gary Kahrau" <kahrau@monair.com> schrieb:[color=blue]
> 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?[/color]

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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Gary Kahrau
Guest
 
Posts: n/a
#3: Nov 21 '05

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


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...



"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:uyxfn9T2EHA.3132@TK2MSFTNGP14.phx.gbl...[color=blue]
> "Gary Kahrau" <kahrau@monair.com> schrieb:[color=green]
> > 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?[/color]
>
> You will have to add a reference to the other project (right-click the
> project in project explorer, choose "Add reference..." from its context[/color]
menu[color=blue]
> and select the "Projects" tab). Notice that you cannot reference Windows
> Forms Application projects. Instead, add the classes to class library
> projects.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
>[/color]


Chris, Master of All Things Insignificant
Guest
 
Posts: n/a
#4: Nov 21 '05

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


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

"Gary Kahrau" <kahrau@monair.com> wrote in message
news:%23PZFwFV2EHA.3452@TK2MSFTNGP14.phx.gbl...[color=blue]
> 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...
>
>
>
> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
> news:uyxfn9T2EHA.3132@TK2MSFTNGP14.phx.gbl...[color=green]
>> "Gary Kahrau" <kahrau@monair.com> schrieb:[color=darkred]
>> > 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?[/color]
>>
>> You will have to add a reference to the other project (right-click the
>> project in project explorer, choose "Add reference..." from its context[/color]
> menu[color=green]
>> and select the "Projects" tab). Notice that you cannot reference Windows
>> Forms Application projects. Instead, add the classes to class library
>> projects.
>>
>> --
>> M S Herfried K. Wagner
>> M V P <URL:http://dotnet.mvps.org/>
>> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
>>[/color]
>
>[/color]


Closed Thread