我想做一个表格,在退出之前询问您是否要保存。我该怎么做?我正在使用Visual Studio 2012,并且以某种方式具有基础知识。
只需处理 FormClosing 事件
Private Sub myForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If MessageBox.Show("Would you like to save before exiting?", "Close", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
'do save stuff here
Else
e.Cancel = True
End If
End Sub