Close button not disabled 
Author Message
 Close button not disabled

I know there is probably an easy way around this, but I have a form that I
don't want the user to be able to exit.  I have removed the control box,
minimize, maximize and the close (x) button.

However, the old window trick of double clicking on the title bar of the
window still maximizes the window.  I don't mind this part.  I'd like the
user to be able to resize.  However, the close button reappears and does
allow the user to exit out.

How can I prevent this keeping in mind I'd still like the user to be able
to resize if needed????

Thanks in advance



Mon, 10 Jul 2000 03:00:00 GMT  
 Close button not disabled

Look at the form Unload event there is a cancel parameter to this event if
you set that to true then the form cannot be unloaded (also if the form
can't be unloaded you're application can't close).

What you do is decode on valid routes for closing the form, then I would
create a new property for the form and set that if I wanted to allow the
form to close. so for example

Where
    Form1 is the form to prevent closing.

'******************  Code Start  ***********************
Private blnAllowClose As Boolean

Private Sub Form_Unload(Cancel As Integer)
  If blnAllowClose = False Then
    MsgBox "You cannot close this form at this time", vbInformation
    Cancel = True
  End If
End Sub

Property Let AllowClose(blnDoClose As Boolean)
'You can do some testing in here to see if its
'appropriate to allow the proerty to be changed
  blnAllowClose = blnDoClose
End Property
'******************  Code End   *************************

Then when you want to allow the user to close the form (for example in a
close form button click event) you'd do this.

    forms!form1.allowclose=true

Quote:

>I know there is probably an easy way around this, but I have a form that I
>don't want the user to be able to exit.  I have removed the control box,
>minimize, maximize and the close (x) button.

>However, the old window trick of double clicking on the title bar of the
>window still maximizes the window.  I don't mind this part.  I'd like the
>user to be able to resize.  However, the close button reappears and does
>allow the user to exit out.

>How can I prevent this keeping in mind I'd still like the user to be able
>to resize if needed????

>Thanks in advance



Tue, 11 Jul 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. close button not disabled

2. Disable Access Close Button not Form Close Button?

3. Disabled Close button / What's this button

4. Disable Close Button of an Excel sheet

5. Disable Close button on sheet

6. Disable Close Button

7. Disable close button on a Userform

8. Disabling the Close Button (x)

9. Disabling Close button on form

10. Disable Close Button (Big X in upper right corner)


 
Powered by phpBB® Forum Software © phpBB Group