Solved

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

Posted on 2009-04-15
3
533 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
[X]
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
  • 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
API v SOA 8 63
ASP.NET Built-In Report Creator / Viewer 5 41
Learning About The VB.NET TableLayoutPanel Control 5 41
Help with Report Viewer in VS2013 6 32
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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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…

739 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