BilalShouman

Hello

I have project1 and project2 in the same solution

How can I call from project1: dim x as new project2.Form1



Re: Windows Forms General Calling Form from another project

Christopher Payne

Project2 must be a class library or control library project (not a Windows application or console application), and Project1 must have a reference to Project2.

To add the reference: open up the Solution Explorer. Right-click on "References" in Project1, and select "Add Reference...". When the dialog comes up, click on the Projects tab and select Project2.





Re: Windows Forms General Calling Form from another project

BilalShouman

Project 1 and 2 are two windows applications...is this possible

Thank you





Re: Windows Forms General Calling Form from another project

Christopher Payne

Not to my knowledge. You can't add a reference to an executable, just a dll. You could launch project2 from within project1, but you won't be able to instantiate objects (like forms) that are in project2 from project1.

I suggest you pull out anything that both project1 and project2 need to have access to, and put that in project3. Make project3 a class library, and add a reference to project3 to both project1 and project2. That is, of course, assuming you can't just change project2 into a class library.