|
-
Apr 22nd, 2006, 05:06 AM
#1
Thread Starter
Junior Member
How do i make my program End when i hit the X button?
when you hit the X button on the very top right, next to the minimize button i need the program to end.
i know i did this the completly wrong but heres my rig so far.
IF form1.Visable = FALSE THEN
END
and it only works sometimes LOL!
please help
-
Apr 22nd, 2006, 07:14 AM
#2
Re: How do i make my program End when i hit the X button?
VB Code:
Private Sub Form_Unload(Cancel As Integer)
Dim frm As Form
For Each frm in Forms
If Not frm Is Me Then Unload frm
Next frm
End Sub
Never use End.
-
Apr 22nd, 2006, 04:36 PM
#3
Thread Starter
Junior Member
Re: How do i make my program End when i hit the X button?
I dont quite understand what that code does.
i have a multi form project, but form1 is the main form, i dont mind if all other forms close with formX.Visable = false. but i need the entire program to shutdown and close when i hit the X button in the (main) form1.
thanks though
-
Apr 22nd, 2006, 04:40 PM
#4
Re: How do i make my program End when i hit the X button?
That code goes in the main form, so when you unload the main form it loops through all the currently open forms and tells them to unload.
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
|