Reputation: 77
I have two different forms as two different projects. I want to have these two forms in the same project so I can have form 1 appear when user clicks on a button in form 2. How can I include one form into another in VS express?
Upvotes: 0
Views: 1191
Reputation: 26078
You can simply add a reference to the second project in the first, add a using statement pointing to that form within the assembly, and upon button click instantiate and show that form.
If you are hell bent on making them in the same project, it should be as easy as just copy pasting that form from one project to another, you may want to change the namespace to match, but you don't have to, again you'll just need to add a using statement to be able to access that form within the other (and make sure it is declared public, you can get away with internal if they are in the same namespace).
Upvotes: 2
Reputation: 995
First of all, why do you want to move the form?
To use the form in another project simply:
To move the form into another project, simply copy the Form2 into the same project as the other. It is usually best practice to have all forms within the same project, especially if they are connected, however sometimes this is not necessarily the case. So do whatever you feel comfortable with.
Of course you should note that the forms cannot have the same name as each other i.e. form1 and form1, and they should be renamed to what they are suited for to avoid confusion in the future. Please do not take your time on this though, it should be quick and easy to identify.
Upvotes: 0