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

Edited 5 Years Ago by abelLazm: n/a

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;
     }
 }
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.