Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open 2nd Project 1

Status
Not open for further replies.

BFT1303

Programmer
Jan 26, 2007
29
US
I am rather new to C# and I this is probably much easier than I am making it. I am trying to have 1 project call and run another project. Also, I am having issues with 1 form trying to open another form.

Thank you for all your help
 
If the projects are in the same Solution - then you have to build one as a Class Library (Right click on the project, go to properties, and it's within the build options)

Then on your main project go to references -> Add Reference and click on the Projects tab. Select the other project (the one that is now a class library) and click ok.

At the top of the class where you want to use this project add

using YourClassLibraryProjectName;

and you can now use all the items from that project that are set to public. If you are using the 2.0 Framework and VisualStudio 2005 - keep in mind that all classes start with

class MyClass
{
}

and to use them in theother project you need to make them

public class MyClass
{
}




As for opeing another form you will want to consider the Model-View-Controller design pattern and the Observer pattern.

Basically, Your forms don't really talk to eachother directly. Instead they talk to a class that both are aware of (the controller) and when there is a change that will affect both forms, the controller will notify each of the forms (the views).

hope that gets you started.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top