|
-
Sep 8th, 2000, 12:37 PM
#1
Thread Starter
New Member
I'd like to make my program run until the user exits with my exit command, and not the termination button. Is there anyway to trap that?
-
Sep 8th, 2000, 12:40 PM
#2
Addicted Member
Hi,
There is one of two ways to do this:
First:
Code:
'Everytime they click the 'x' it cancels itself
Private Sub Form_Unload(Cancel As Integer)
Cancel = 1
End Sub
Second:
Set the ControlBox property of the form to False so that no 'x' is shown.
Hope this helps
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 8th, 2000, 12:44 PM
#3
Frenzied Member
No! Don't do that You won't be able to ever close your prog!!!
Use
Code:
Public DontCancelMe As Boolean
Private Sub Form_QueryUnload(cancel as integer)
If DontCancelMe = False Then
'Exit via the X button, don't close
Cancel = 1
End If
'Else it's via your button, so close it!
End Sub
Private Sub ExitMe_Click
DontCancelMe = True
Unload Me
End Sub
This'll work!
[Edited by Jop on 09-08-2000 at 01:48 PM]
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 8th, 2000, 12:48 PM
#4
Addicted Member
Hi Jop,
He did say that he has his own Exit command so that they would still be able to exit his App 
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 8th, 2000, 12:54 PM
#5
Frenzied Member
I think he meant his own way to exit (in a menu with extra confirmation).
And in your case (Form_Unload) you're not able to unload the prog in any way (yeah end maybe, but not in a proper way)
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 8th, 2000, 12:59 PM
#6
Addicted Member
Not arguing with you 
What's wrong with End anyway?
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 8th, 2000, 01:06 PM
#7
Frenzied Member
Hey, one thing, no hard feelings man! I'm serious, I'm not trying to be 'better' than you, end just does what it says, it just ends the prog without Unloading it from the memory, so it's not a good idea to just quit it leaving the resources unavailable for other progs. That's what the Unload is for, making sure the used resources are made free.
get it? (I ain't mad at ya )
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Sep 8th, 2000, 01:15 PM
#8
Thread Starter
New Member
Are you two married? Just seemed there was a little arguing going on there. Thanks for the help though.
-
Sep 8th, 2000, 01:18 PM
#9
Addicted Member
No arguing! 
Jop is right, I've always used End and didn't know any better.
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 8th, 2000, 01:19 PM
#10
Frenzied Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|