Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now