as usercontrol or as form

J

Jason

Hi

I would like a user control/form that can be either called as a dialog
(ShowDialog) or embedded in another form (usercontrol).

preferably, my dialog/usercontrol accepts an argument that specifies which
mode it should be, i.e. embedded or dialog...

what is the best way of accomplishing this?

Thanks
Jason
 
N

Nicholas Paldino [.NET/C# MVP]

Jason,

I think that this is bad design. A control is meant to be embedded
within another window, while a form is not (not counting MDI children).
Because of this, you should have separate classes to handle these situations
when they arise.

I think that what you should do is create the user control, and then
have a class in the assembly which is nothing more than a form that hosts
the dialog, which can then have the ShowDialog method called on it.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top