Solved

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

Posted on 2009-04-15
3
531 Views
Last Modified: 2013-11-25
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.
0
Comment
Question by:rangers99
  • 2
3 Comments
 
LVL 15

Expert Comment

by:angus_young_acdc
ID: 24145936
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).
0
 

Author Comment

by:rangers99
ID: 24145976
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?
0
 
LVL 15

Accepted Solution

by:
angus_young_acdc earned 125 total points
ID: 24146156
Unfortunately not.  It is likely because you have a reference to Calculations in UserInterface.

You will either have to re-work all your references, or just add a Form to your Calculations class (changing it to a Win App Class) and open it from there.
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question