Disabling close [X] button in VB.Net
See subject! Tried the VB6 implementation that I found on the site but get the error "Hwnd is not a member of 'My_Prog_name.MainForm'" when trying to compile for debugging. Any ideas anyone??!?
I'm assuming there's probably a very easy way to do this in VB.net instead of grabbing the forms handle.:)
Re: Disabling close [X] button in VB.Net
Quote:
Originally posted by DWetherilt
The program still needs to minimize and maximize from the toolbar but it can't close as there will probably be open files if the main process isn't stopped in the correct manner. This is the main reason that I need to handle the close box directly.
I'm still a little new at this :o, so I apologize in advance if I am misunderstanding your situation, but I know that if the user closes a form using the X button, you can catch the event, and even cancel it, if you want. So another way to solve your problem may be to catch that event and write code that makes sure that the process is stopped correctly before closing the program.
I saw some sample code somewhere (I can try to find it again, if you would like) that showed how to catch a close event and determine where it came from (closing the form by hitting the close button, closing the parent form, using the form menu, etc.). The point of the sample code that I saw was to handle the scenario when the user clicked the close [X] button. If anyone wants to see the code, let me know I'll try to find it and post it here.
you might find this helpful
http://www.vbforums.com/showthread.p...hreadid=159297
that link is to a thread where i talk to myself about adding a menu item to a forms system menu not it's menu bar it's system menu
after rereading that damn i sound like a jerk