Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2009-04-15
3
530 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

829 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