VB.NET overload default functionality when user clicks the X (Close Program)
问题 How do I go about overriding the default functionality when a user clicks the X in a VB.NET form-based application? I am currently handling the MyBase.Closing event... but since it's a DirectX app, I need to do some cleanup before allowing the form the close. 回答1: If you want to do some extra clean up before a form closes, do so in the form's Form Closing event. This event also allows you to cancel the form close through the event's FormClosingEventArgs.Cancel property. The event's