by Aaron (3 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 13th September 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Prevent your app from being unloaded or terminated with this code.(Change)
'****it won't quit. If you call END in your code it will bypass this function!
' This is a sample where if Form1 is attempted to be unloaded, a new
' instance of Form1 is created, thus preventing the app from being terminated.
' Of course, you will have to restore any information that will be lost in the
' unload function. Also, sometimes Unload invokes Terminate, so make sure that
' only one of those procedures contains code.
Private Sub Form_Unload(Cancel As Integer)
Cancel = 1
endsub
Private Sub Form_Unload(Cancel As Integer)
Dim a As New Form1
a.Width = Me.Width
a.Height = Me.Height
a.Left = Me.Left
a.Top = Me.Top
Me.Hide
a.Show
End Sub
No comments have been posted about Prevent your app from being unloaded or terminated with this code.(Change). Why not be the first to post a comment about Prevent your app from being unloaded or terminated with this code.(Change).