<p>I want to load a desktop application, via reflection, as a Control inside another application.</p>

<p>The application I'm reflecting is a legacy one - I can't make changes to it.</p>

<p>I can dynamically access the Form, but can't load it as a Control.</p>

<p>In .Net Form expands on Control, and I can assign the reflected Form as a Control, but it throws a run-time exception.</p>

<p>Forms cannot be loaded as controls.</p>

<p>Is there any way to convert the form to a control? </p>

[{'answer_id': 51428, 'author': 'Rob Stevenson-Leggett', 'author_id': 4950, 'author_profile': 'https://Stackoverflow.com/users/4950', 'pm_score': 1, 'selected': False, 'text': '<p>You should be able to add the form to the controls collection of your parent form...</p>\n\n<p>See here: \n<a href="http://vbcity.com/forums/topic.asp?tid=30539" rel="nofollow noreferrer"><a href="http://vbcity.com/forums/topic.asp?tid=30539" rel="nofollow noreferrer">http://vbcity.com/forums/topic.asp?tid=30539</a></a></p>\n\n<p>If that fails, try using the adapter pattern to create a container with your legacy form inside it, then load it in an MDI maybe?</p>\n'}, {'answer_id': 51433, 'author': 'Andrew', 'author_id': 826, 'author_profile': 'https://Stackoverflow.com/users/826', 'pm_score': 4, 'selected': True, 'text': "<p>Yes, this works just fine. I'm working on a .NET app right now that loads forms into a panel on a host form.</p>\n\n<p>The relevant snippet:</p>\n\n<pre><code>// setup the new form\nform.TopLevel = false;\nform.FormBorderStyle = FormBorderStyle.None;\nform.Dock = DockStyle.Fill;\nform.Show ( );\n\n// add to the panel's list of child controls\npanelFormHost.Controls.Add ( form );\n</code></pre>\n"}, {'answer_id': 51437, 'author': 'dan gibson', 'author_id': 4495, 'author_profile': 'https://Stackoverflow.com/users/4495', 'pm_score': 1, 'selected': False, 'text': '<p>What is the exception you get? Is it possible that the control itself is giving the exception (vs the framework)? Perhaps something is called in the original applications Main function that is not being called?</p>\n'}]
['https://Stackoverflow.com/questions/51407', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/905/']