Click here to Skip to main content
15,889,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dissecting the MessageBox[^]

Hello
In the above link it is given how to disable close button by passing the form as parameter..
How to pass message box as the parameter??
Posted
Updated 23-May-12 18:06pm
v2
Comments
Abhishek Durvasula 28-May-12 8:25am    
Can Anyone help me with how to use the above code to disable messagebox close button?a small sample project would be helpful

The standard MessageBox class of .NET shows the MessageBox by the Show static method. The Show static method generates the MessageBox internally using the various arguments passed to it and returns DialogResult enum member.

The actual instance of the MessageBox is not available to the user to manipulate the content and features of MessageBox like disabling the close button.

Hence, the author of the Article referred in the question has created a custom extended message box with several features. One of the feature is to disable the close button.

The extended MessageBox created by the author is derived from the Windows.Forms.Form as can be seen from the class declaration given in the source code downloaded from the above article show below
C#
internal class MessageBoxExForm : System.Windows.Forms.Form


Since, the extended MessageBox is derived from the Form class it can be passed to the private void DisableCloseButton(Form form) as an argument. This method is not meant to pass the standard MessageBox to it.
 
Share this answer
 
Comments
Maciej Los 24-May-12 11:56am    
Great answer, my 5!
VJ Reddy 25-May-12 6:17am    
Thank you, losmac :)
Wendelius 24-May-12 15:00pm    
Good answer
VJ Reddy 25-May-12 6:18am    
Thank you, Mika :)
Sandeep Mewara 25-May-12 0:53am    
My 5!
We can't read the entire above link. Tell us the problem, and it is possible that you will get your answer.
 
Share this answer
 
Comments
Maciej Los 24-May-12 11:56am    
Is this an answer? This is a comment.

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