VB.NET overload default functionality when user clicks the X (Close Program)

后端 未结 3 560
时光说笑
时光说笑 2021-01-15 10:04

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.

3条回答
  •  感动是毒
    2021-01-15 10:26

    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 CloseReason property will tell you why the event was called (you'd check for CloseReason.UserClosing)

提交回复
热议问题