Windows Forms - Disable the Close Button

I’ve seen it asked over and over, “How do I disable the close button without having to remove the system menu, minimize and maximize buttons?”.  I’ve created an article that shows two separate methods for doing so.  The first is the one that seems to be very popular and rehashed several times in various message boards.  However, although it disables the actual button, it removes the Close menu item, which in my mind isn’t the proper way of doing this.  I show a second method that follows the example shown in the Platform SDK documentation for actually disabling the Close menu item. Also, it requires a lot less interop calls (two methods as opposed to five or more depending on if you will be trying to show the error messages).

Article: Windows Forms - Disable the Close Button

This post is licensed under CC BY 4.0 by the author.