Code to Disable close button on the form UserPageVisits:261 active 80 80 DaniWeb 561 60 2011-04-04T10:17:12+00:00 https://www.daniweb.com/programming/software-development/code/357628/code-to-disable-close-button-on-the-form

Code to Disable close button on the form

abelLazm

Add this code any where in your main form and You will be able to disable the X button on a winForm

261 Views
About the Author

I am a Computer professional has just completed my MPHIL in computer sciences and currently working as software engineer in a private company

code snippet
private const int dis_close_button = 0x200;
 protected override CreateParams CreateParams
 {
     get
     {
        CreateParams ObjCP = base.CreateParams;
        ObjCP.ClassStyle = ObjCP.ClassStyle | dis_close_button ;
        return ObjCP;
     }
 }