
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