Reputation: 3644
I found this post and I would like to do the second option in the first answer
2) If the app is only useful within the context of the parent apps, say by being given objects or other arguments from the other apps, consider refactoring the small app to allow the form's project to be referenced by the parent apps. Then, your parent apps can simply create a new instance of the form and display it:
var childForm = new SmallAppForm(); childForm.Owner = this; //the child window will close when its owner does. childForm.Show();
I have some questions about what steps I would have to do in order to accomplish it.
The app that I trying to call can be found here.
To change it so that I have a main (parent) form that creates and calls this application like a class, would I add a new project that would be the "parent", add the Main to my new parent form so that it is the application. Then have a menu choice to start the wizard in the parent form in order to create and call my wizard like this?
CreateUserContext context = new CreateUserContext();
CreateUserWizard wizard = new CreateUserWizard(context);
Thanks for any guidance, Leslie
Upvotes: 0
Views: 236
Reputation: 372
Add a class library and put the classes of your SmallFormApp in it. This class library will be under the same solution. Then go ahead and reference this in your ParentForm and use the functions in it.
Upvotes: 1
Reputation: 86600
What I would do is to tranform the small aplication into a Class Library instead of a Winforms application. (It can also be a project within the solution, referenced by the main project)
Then, the parent application just references the small application and calls the new SmallAppForm()
Of course the SmallAppForm must be public.
Class Library is the project type. When you create a project, it can be console application, windows form application, class library and many others. So you should create a new project as class library type.
Copy all your forms of the small applications to this project, make the classes public.
(There's no program
class in a class library, just the forms and other classes you created)
Upvotes: 0