|
-
Jul 25th, 2005, 11:20 PM
#1
Disable Close button
For all those who are interested, I have posted some code in the CodeBank that will disable the Close button on the title bar of a form. I don't know if it's been seen before but I've not heard mention of it and I'm too lazy to search. 
http://www.vbforums.com/showthread.php?t=351541
-
Jul 26th, 2005, 01:48 AM
#2
-
Jul 26th, 2005, 01:55 AM
#3
Re: Disable Close button
 Originally Posted by NoteMe
If you check the CodeBank you'll see that the code gets rid of the bath water (Close button) but leaves the baby (title bar, system menu, icon, Minimize and Maximize buttons) behind.
-
Jul 26th, 2005, 09:52 AM
#4
Re: Disable Close button
e.cancel
does the job just as well Doesn't require API either.
I don't live here any more.
-
Jul 26th, 2005, 09:59 AM
#5
Re: Disable Close button
I would consider it better practice to prevent an illegal action being performed in the first place than allowing it and then telling the user they have done something wrong. If you want to only allow the use of the Close button under certain circumstances or make sure some action occurs when it is used, then the Closing event is a good option. If you want to disallow use of the Close button altogether, as some people seem to want to, then disabling it is a better idea.
I don't understand why some people seem so hell-bent on differentiating the use of that Close button from other methods of closing a form or app. As far as I'm concerned closing a form is closing a form, and if there is some essential action to perform then do it from the Closing event handler. As some do seem keen to make the distinction, I thought that this would be good to know.
Last edited by jmcilhinney; Jul 26th, 2005 at 10:01 AM.
Reason: Spelling error
-
Jul 26th, 2005, 10:03 AM
#6
Re: Disable Close button
I guess the biggest reason is because it is an unexpected event...not supposed to happen...
- ØØ -
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
|