Do not close form on clicking close button in Visual Basic 
Author Message
 Do not close form on clicking close button in Visual Basic
Hi All,
    I have created a standard exe in Visual Basic 6.0.
    I have a form named form1 on it.
    whenever the user clicks on the close button of the form i don't want to
end my application and simply hide it.
    How can I achieve this.
Regards,
Sriram




Sun, 16 May 2004 22:15:39 GMT  
 Do not close form on clicking close button in Visual Basic
Place this code in the QueryUnload event of your form.
'================
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
   If UnloadMode = vbFormControlMenu Then
      Cancel = True
      Me.Hide
   End If
End Sub
'================

--
Ken Halter
MS-MVP-VB
http://www.vbsight.com
Please respond only to the newsgroups so all can benefit.
Besides.. I check my email only once a week :-)


Quote:
> Hi All,
>     I have created a standard exe in visual basic 6.0.
>     I have a form named form1 on it.
>     whenever the user clicks on the close button of the form i don't want
to
> end my application and simply hide it.
>     How can I achieve this.
> Regards,
> Sriram




Sun, 16 May 2004 23:05:09 GMT  
 Do not close form on clicking close button in Visual Basic
On Wed, 28 Nov 2001 19:45:39 +0530, "Sriram Mallajyosula"

Quote:

>Hi All,
>    I have created a standard exe in visual basic 6.0.
>    I have a form named form1 on it.
>    whenever the user clicks on the close button of the form i don't want to
>end my application and simply hide it.
>    How can I achieve this.
>Regards,
>Sriram


Look up QueryUnload in the Help files.  This is triggered whenever a
request is made to close a form.  This will tell you all you need to
know about what happens when you try to close a form.

Stuart Sutherland



Mon, 17 May 2004 03:04:10 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Form Close Button Does Not Close the Form

2. Form does not close from the UpperRight X Close button

3. Bound Control not updating underlying recordset when clicking close button

4. Prevent user from closing form using caption close button

5. problems using close [x] button when closing forms.

6. How to prevent user closing a mdi form using the close control button

7. Form automatically close after clicking Apply button

8. Detect form close button being clicked

9. catch click close button (X) of a form without subclassing

10. catch click close button (X) of a form without subclassing

11. window.close closes webbrowser but not the form itself

12. window.close closes Webbrowser but not the form itself

 

 
Powered by phpBB® Forum Software