Modal


Modal - ShowDialog

These must be closed or hidden before continuing.
The FormClosing event will run regardless of the method used to close the form (me.close or corner cross)
If the form is displayed as a modal dialog box (using ShowDialog) clicking X in the upper right corner causes the form to be hidden and the DialogResult property to be set to DialogResult.Cancel.
This can be overridden by setting it to a different value in the FormClosing event.



Dim dlgDialog As New frmDialog() 
If dlgDialog.ShowDialog = System.Windows.Forms.DialogResult.Yes Then

End If

Closing a Form


Me.Dispose 'this is essential when the dialog has been displayed using ShowDialog  
Me.Close



© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext