0

This question asks how you embed a form in a TabPage from another form.

This questions and this question ask if it is possible to embed a form in a control in general.

This is something that I assumed you just couldn't do because why would you?

But, as the linked questions demonstrate, it is possible. And sometimes it appears to be necessary.

Hans Passant states that if you set the TopLevel property to false you get a

child window, almost indistinguishable from a UserControl

My question is:

What are the main reasons you would NOT do this?

Why specifically is it better to go through the effort of refactoring into a user control?

Before I saw these questions, I would have immediately assumed there must be (at the very least) a performance implication of embedding a form vs embedding a user control. I would have assumed there would be some additional overhead running for a form that does not run for a user control. But now I'm not so sure.

I would still do the refactor anyway (if I could) but I realised when viewing these questions that I don't have a concrete reason other than "it doesn't feel right to embed a form".

J M
  • 1,877
  • 2
  • 20
  • 32
  • If you going to use designer, then you wouldn't be able to add forms as controls.. I think. Otherwise, go with whatever works for you, until you hit something. – Sinatr Jan 11 '18 at 14:54
  • @Sinatr I don’t agree that this is a duplicate. The question you link to doesn’t answer the question about why you would not make use of a feature that is allowed I.e. using a Form as a control. I didn’t ask what the difference between forms and controls are – J M Jan 11 '18 at 14:56
  • @Sinatr I completely disagree with you. What answer of the potential [dup](https://stackoverflow.com/questions/2299339/user-control-vs-windows-form) shell answer this question asked here? IMO the link is totally unsatisfying for OP. – L. Guthardt Jan 11 '18 at 15:05
  • Well, In the comments, Hans Passant states there is going to be a small, insignificant penalty in memory usage, but it's not in the answer itself. – Zohar Peled Jan 11 '18 at 15:16
  • @ZoharPeled: Ah, see I didn't see that comment. I'm closing it as suggested taking away that there are at least two reasons; designer support and the memory usage hit. – J M Jan 11 '18 at 21:16

0 Answers0