|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can forms in different projects reference one another?Me again. Is it possible to have two projects in a solution (ProjA and
ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried the following, but I get a problem with the reference Sub ShowFormB Dim frm as new < ? FormB?? various things I tried here> frm.Show() Me.Close() End Sub Thanks MikeB,
ProjA must have a reference to ProjB. In the Solution Explorer window, right-click ProjA and select Add Reference. From the Add Reference dialog, click the Projects tab and select ProjB. Now your ProjA can show a form in ProjB: Dim frm As New ProjB.SomeForm frm.Show() Kerry Moorman Show quoteHide quote "MikeB" wrote: > Me again. Is it possible to have two projects in a solution (ProjA and > ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried > the following, but I get a problem with the reference > > Sub ShowFormB > Dim frm as new < ? FormB?? various things I tried here> > frm.Show() > Me.Close() > End Sub > > Thanks > >
Show quote
Hide quote
"Kerry Moorman" <KerryMoor***@discussions.microsoft.com> wrote in message This is kinda tricky. What I would prefer in my own projects would be to news:33D804A6-5033-4324-AC5E-E25881D0CC2C@microsoft.com... > MikeB, > > ProjA must have a reference to ProjB. In the Solution Explorer window, > right-click ProjA and select Add Reference. From the Add Reference dialog, > click the Projects tab and select ProjB. > > Now your ProjA can show a form in ProjB: > > Dim frm As New ProjB.SomeForm > frm.Show() > > Kerry Moorman > > "MikeB" wrote: > >> Me again. Is it possible to have two projects in a solution (ProjA and >> ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried >> the following, but I get a problem with the reference >> >> Sub ShowFormB >> Dim frm as new < ? FormB?? various things I tried here> >> frm.Show() >> Me.Close() >> End Sub >> >> Thanks >> >> create a separate library project for the shared forms. This project would then be referenced by the two winforms projects. This prevents circular references from occurring. HTH, Mythran That's all well and good but when you are writing and debugging code, it's a
pain to load the library class and change it's code...also hard to find some errors. That's the beauty of putting all your related projects into one solution at least until you've finished debugging them. -- Show quoteHide quoteDennis in Houston "Mythran" wrote: > > "Kerry Moorman" <KerryMoor***@discussions.microsoft.com> wrote in message > news:33D804A6-5033-4324-AC5E-E25881D0CC2C@microsoft.com... > > MikeB, > > > > ProjA must have a reference to ProjB. In the Solution Explorer window, > > right-click ProjA and select Add Reference. From the Add Reference dialog, > > click the Projects tab and select ProjB. > > > > Now your ProjA can show a form in ProjB: > > > > Dim frm As New ProjB.SomeForm > > frm.Show() > > > > Kerry Moorman > > > > "MikeB" wrote: > > > >> Me again. Is it possible to have two projects in a solution (ProjA and > >> ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried > >> the following, but I get a problem with the reference > >> > >> Sub ShowFormB > >> Dim frm as new < ? FormB?? various things I tried here> > >> frm.Show() > >> Me.Close() > >> End Sub > >> > >> Thanks > >> > >> > > This is kinda tricky. What I would prefer in my own projects would be to > create a separate library project for the shared forms. This project would > then be referenced by the two winforms projects. This prevents circular > references from occurring. > > HTH, > Mythran > > >
Show quote
Hide quote
"Dennis" <Den***@discussions.microsoft.com> wrote in message Yeah, you would put these shared forms into a project that is part of the news:2336EB31-AD54-4FFD-AA6C-B0559F05A35E@microsoft.com... > That's all well and good but when you are writing and debugging code, it's > a > pain to load the library class and change it's code...also hard to find > some > errors. That's the beauty of putting all your related projects into one > solution at least until you've finished debugging them. > -- > Dennis in Houston > > > "Mythran" wrote: > >> >> "Kerry Moorman" <KerryMoor***@discussions.microsoft.com> wrote in message >> news:33D804A6-5033-4324-AC5E-E25881D0CC2C@microsoft.com... same solution and reference this project as a project reference from the two winforms projects. Mythran Kerry, thank you.
Does this mean that the Projects have to have names consisting of one word only? Is there a way to (for instance) use "Host Country" and "Travel Information" as project names? MikeB Kerry Moorman wrote: Show quoteHide quote > MikeB, > > ProjA must have a reference to ProjB. In the Solution Explorer window, > right-click ProjA and select Add Reference. From the Add Reference dialog, > click the Projects tab and select ProjB. > > Now your ProjA can show a form in ProjB: > > Dim frm As New ProjB.SomeForm > frm.Show() > > Kerry Moorman > > "MikeB" wrote: > > > Me again. Is it possible to have two projects in a solution (ProjA and > > ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried > > the following, but I get a problem with the reference > > > > Sub ShowFormB > > Dim frm as new < ? FormB?? various things I tried here> > > frm.Show() > > Me.Close() > > End Sub > > > > Thanks > > > > MikeB,
You can have mutliple word project names, such as "Host Country". But I think that the space gets replaced by an underscore by .Net, like this: Dim frm As New Host_Country.SomeForm Kerry Moorman Show quoteHide quote "MikeB" wrote: > Kerry, thank you. > > Does this mean that the Projects have to have names consisting of one > word only? Is there a way to (for instance) use "Host Country" and > "Travel Information" as project names? > > MikeB > > Kerry Moorman wrote: > > MikeB, > > > > ProjA must have a reference to ProjB. In the Solution Explorer window, > > right-click ProjA and select Add Reference. From the Add Reference dialog, > > click the Projects tab and select ProjB. > > > > Now your ProjA can show a form in ProjB: > > > > Dim frm As New ProjB.SomeForm > > frm.Show() > > > > Kerry Moorman > > > > "MikeB" wrote: > > > > > Me again. Is it possible to have two projects in a solution (ProjA and > > > ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried > > > the following, but I get a problem with the reference > > > > > > Sub ShowFormB > > > Dim frm as new < ? FormB?? various things I tried here> > > > frm.Show() > > > Me.Close() > > > End Sub > > > > > > Thanks > > > > > > > > "Kerry Moorman" <KerryMoor***@discussions.microsoft.com> schrieb: In this case I'd set a more appropriate root namespace in the project > You can have mutliple word project names, such as "Host Country". But I > think that the space gets replaced by an underscore by .Net, like this: > > Dim frm As New Host_Country.SomeForm properties. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> |
|||||||||||||||||||||||