newbie: two projects in the same solution and accessing different forms

S

steve

Hello, i have a few fundamental questions that i dont seem to get an answer:

I have my main project inside my main solution. Now, separately i created another project with 4 forms. I want to access these forms fromthe main project. what is my best choise?

Should i just "Add Existing Item..." or Add the whole project and join the two under one solution?

I am experimenting with the second solution for now but i cant seem to create an instance of one of the forms....
This is what i try to type as the handler for a button:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim XTransform As MyProject2.Xtransform = New MyProject2.Xtransform

Xtransform.show()

End Sub



But MyProject2.Xtransform unknown...., also tried: MySolution.MyProject2.Xtransform with no success.

Any help with this stupid question :) would be greatly appreciated.

TIA
 
M

Mohamoss

Hi Steve
Having two projects within the same solution doesn't mean that they are
considered one entity. In fact a project is compiled into one (or more)
assembly and two projects never share an assembly. Therefore, each of your
project is an independent assembly of its own. so they are very separate
entities. What you can do is to build one of them. Then , on the other
project ( where you want to use the form ) click on add references , and
chose the projects tab ( it will show projects within the same solution )
then you can add reference of that other solution and create instance from
it .
However on that case you will have an instance of the whole project ( not
a single form on it ) so you can open that and then browse the your form .
on that case you will deal with the referenced project as one object where
your desired form will be an inner object of that .
What add existing item will do is that it will just take a copy of the
form on the other project and paste it to the current project so it will
be just a new copy . this is ok however if you want to replicate the
function of that form on your current project .
Hope that was clear

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 

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

Top