First of all, you did not add an instance of calendar to anything. The method
Show
is just irrelevant. It's the antonym of
Hide
. You only need to call
Show
for forms. What you need is adding:
MonthCalendar MonthCalendar = new MonthCalendar();
Panel PanelCalendar = new Panel();
MonthCalendar.
PanelCalendar.Controls.Add(MonthCalendar);
All controls are inserted in each other in hierarchy, up to the parent form. There is no functional parent-child relationship between forms though, instead, use
OwnedForm/Owner
relationship if you use more than one.
Any kind of pop-up is bad, especially you are going to create and insert an instance of your calendar over and over. If you don't want to see it on the form permanently and update it on some events (but why not?), you can add it once and hide/show, shrink the parent panel, hide it in a tab of
TabControl
which you can select on demand, dock it… so many sensible options. Pop-ups are intrusive, inconvenient and, I would say… childish. :-)
—SA