I am working with two C# projects in one Microsoft Visual Studios solution. One project contains a form used to select which form from the other project to open. I also have a 'Back' button on each of my Project 2 forms, which I hope to use to reopen the form selector from the first project. I have researched how to get around circular reference dependencies with no luck. I would prefer to keep these as two separate projects. Will I need to consolidate everything into one messy project, or is there a way to accomplish what I'm trying to do? Thank you in advance.
EDIT:
I found a simple, but effective solution. I only need to reference Project 2 from Project 1, because I can pass through the Project 1 form as a parameter into the Project 2 forms, then display the first form whenever a button is clicked. Thank you again.
Follow these steps:
In Program.cs add the following code:
private static void OpenForm(String formName) { if (formName == "Form1") // Open your Form1 else // Open second Form2 }
Now you can just open the forms on the button click event click by:
Process.Start("Opener.exe Form1");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.