-1

If two project in an solution ,how to open one of the form from Project 1 through this I go to form of project 2 and how can I go back to previous form in C#??

AMU
  • 43
  • 5

1 Answers1

0

Right click on project1 in Solution Explorer. Add -> Reference -> Solution -> [Choose project2 and mark it] -> OK

in project1 make something like this:

using project2; //or whatever namespace you have in project2

and then call it like that somewhere:

FormFromProject2.Show(); //FormFromProject2 is the name of the Form type you want to call

Voila!

Szer
  • 3,426
  • 3
  • 16
  • 36
  • i used to open that form from project 2, and if make both of it,it shows circular dependency error – AMU Feb 25 '15 at 17:23
  • If you referenced project1 in project2 then you used it somewhere for something. Could you show us what you tried to do? – Szer Feb 25 '15 at 17:29
  • I just nothing done yet because i already add reference project 1 in project 2,and i run it and open form 2 from form1 on button click , and there is a button to call form 2 from from 1,wat code want to give to that button of form2 – AMU Feb 25 '15 at 17:35
  • if those forms can call each other, why you divided them by different projects??? Just put them in one project and do Form.Show() – Szer Feb 25 '15 at 18:01
  • I think dependency can be resolved.both the peoject are from different parents. – AMU Feb 25 '15 at 18:26