This is a VB.NET code excerpt from the program I develop from WT Construction - Delivery Monitoring System. This piece of small code will let you select Yes No Cancel button once you are going to exit on the program.
If you select Yes upon exit, it will exit from the program else it will remain on the program.
Figure 1. MenuStrip
As you can see on Figure 1 the exit button is selected.
Figure 2. Yes No Cancel MessageBox
After the Exit button is selected the Yes No Cancel MessageBox prompt displays.
If you press Yes it will literally exit from the program, else it will remain on the program.
This is my code:
-------------------
If you select Yes upon exit, it will exit from the program else it will remain on the program.
Figure 1. MenuStrip
As you can see on Figure 1 the exit button is selected.
Figure 2. Yes No Cancel MessageBox
After the Exit button is selected the Yes No Cancel MessageBox prompt displays.
If you press Yes it will literally exit from the program, else it will remain on the program.
This is my code:
-------------------
Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click Dim exit_result As Integer = MsgBox("Are you sure you want to exit?", MsgBoxStyle.YesNoCancel) If exit_result = vbYes Then Me.Close() End If End Sub
No comments:
Post a Comment