I'm not sure if someone else has beaten me to it because I couldn't be bothered searching too hard, but here is a method to disable the Close button in the title bar and the Close option of the system menu of a form.Code:private const int SC_CLOSE = 0xF060; private const int MF_GRAYED = 0x1; [DllImport("user32.dll")] private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); [DllImport("user32.dll")] private static extern int EnableMenuItem(IntPtr hMenu, int wIDEnableItem, int wEnable); private void Form1_Load(object sender, System.EventArgs e) { EnableMenuItem(GetSystemMenu(this.Handle, false), SC_CLOSE, MF_GRAYED); }




Reply With Quote