VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Prevent your app from being unloaded or terminated with this code.(Change)

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)

Rate 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


Download this snippet    Add to My Saved Code

Prevent your app from being unloaded or terminated with this code.(Change) Comments

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).

Post your comment

Subject:
Message:
0/1000 characters