### Disable Form Close X Button

To disable the "Close X "on a form use the MainForm CloseRequest event and run eventdata.consume.
`Sub MainForm_CloseRequest (EventData As Event)
EventData.Consume
End Sub`
To handle application closure ("Exit the App") an AppExit routine can be defined and called accordingly.
`Sub AppExit
' Handle any app closing actions next
' ...
' Close the form
MainForm.Close
End Sub`
This sub can then be run within
`Sub MainForm_CloseRequest (EventData As Event)
AppExit
End Sub`
or in a Button action
`Sub buttonOK_Action
AppExit
End Sub`

Changed: , Category: Forms, File: T6C195M1416.htm, ID: 1416