Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i know the what is modal and modeless dialogs in win forms.

form.show();-->modeless dailog.
form.showdialog();-->modal dialog



but whenever we cal show method on messagebox it acts as modal dialog can you please explain me what is happening here.
Posted

1 solution

A MessageBox is a special subclass of Form which is always modal; because this is what a confirmation/information/notification message box is supposed to be.

If you want your message box to appear as modeless, then you needa Form, not a MessageBox. You can subclass the Form class to create your own version of message box, mimicing the look and behaviour of the classic message box, but with the ability to call either Show or ShowDialog method.
 
Share this answer
 
Comments
Afzaal Ahmad Zeeshan 21-Oct-15 3:17am    
5ed!
phil.o 21-Oct-15 3:19am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900