Link to home
Start Free TrialLog in
Avatar of rangers99
rangers99

asked on

How Do I display Form from another project withn my Visual C# Application?

Im developing a Windows application (not web-based) using Visual Studio 2008 running under Windows XP Business. Im programming in Visual C#.

My solution (*.sln) file contains 2 projects each of which contain several classes. One of the projects contains the Windows user interface eg. the windows that the project will display.

Lets say the solution file is called bob.sln
And bob.sln contains 2 projects which are;

UserInterface
Calculations

The UserInterface project contains a form called ResultWindow.cs
The Calculations project contains a file(class) called result.cs

Within result.cs I want to do this;

ResultWindow test = new ResultWindow();
test.Show();

But how do I get access to the ResultWindow form from result.cs?

Can I do this? I think I should be using a "using" statement at the beginning of result.cs so I can access ResultWindow form but Ive had no joy trying this.
Avatar of angus_young_acdc
angus_young_acdc
Flag of United Kingdom of Great Britain and Northern Ireland image

You will need to add a reference in your Calculations project to the UserInterface project.  Right click References, then select Projects and then add it.  Now you should be able to right click on ResultWindow and add the using statement (or just type using ResultWindow at the top of the code).
Avatar of rangers99
rangers99

ASKER

Thanks Angus. I just tried that and got this error message;

"A reference to 'UserInterface' could not be added. Adding this project as a reference would cause a circular dependency."

Is there any way round this problem?
ASKER CERTIFIED SOLUTION
Avatar of angus_young_acdc
angus_young_acdc
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial