|
-
Jun 15th, 2001, 05:37 AM
#1
Thread Starter
Frenzied Member
Code for ending programme
How do I implement code for ending the programme by clicking the cross at the upper left corner?
-
Jun 15th, 2001, 05:44 AM
#2
I am not exactly sure what you mean, but if you put:
this will close all the componants of the program.
-
Jun 15th, 2001, 05:52 AM
#3
Black Cat
Using "End" will cause problems. You need to unload all forms and make sure all the objects you've reference or created are set to Nothing.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jun 15th, 2001, 06:15 AM
#4
Thread Starter
Frenzied Member
I must have been misunderstood. I know that unload and end causes the programme to end, but what is the syntax do I use in the Terminat-procedure? I have used the code below, but the programme terminates, when I click the cross and then it asks me if I want to end.
Code:
Private Sub MDIForm_Terminate()
Msg = "Do you want to end the calculations?"
Style = 36
Title = "Tester"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
End
End If
End Sub
-
Jun 15th, 2001, 06:22 AM
#5
Fanatic Member
...or
Code:
Private Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
Dim Msg ' Declare variable.
If UnloadMode > 0 Then
' If exiting the application.
Msg = "Do you really want to exit the application?"
Else
' If just closing the form.
Msg = "Do you really want to close the form?"
End If
' If user clicks the No button, stop QueryUnload.
If MsgBox(Msg, vbQuestion + vbYesNo, Me.Caption) = vbNo Then Cancel = True
End Sub
Mindcrime : )
ICQ 24003332
VB 5.0, VB 6.0 SP5, COM, DCOM, VB.NET Beta 2, Oracle 8
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
|