Start by opening or creating a windows form application.
 
Go to your design of form1 and click the events button at the formproperties.


Look for the event called "formclosing"

Double click the event and enter the following code:


If e.CloseReason = CloseReason.UserClosing Then
            e.Cancel = True
        End If


If you now run your project and click the close button, it won't close!
You can also remove the close button by setting Controlbox to false in form1 properties.