Click to See Complete Forum and Search --> : the "X"
deDogs
Dec 5th, 1999, 01:33 AM
I have two forms which I would like to keep loaded. I switch between each form by hiding one of the forms. The problem is when the user clicks on the "X" which unloads the form. I need to keep both forms loaded at all times.
It is possible to disable the "X", but is there a way to make it disappear? Is there a way to make all three disappear from a form?
Thanks
deDogs
rino_2
Dec 5th, 1999, 02:12 AM
Hi,
On the form properties change the ControlBox option to False. That will make all the buttons invisible.
Ryan
Dec 5th, 1999, 06:08 AM
Try the tip: http://www.vb-world.net/tips/tip117.html
------------------
Ryan French
Niresoft Incorporated
http://www.niresoft.com
support@niresoft.com
SteveS
Dec 5th, 1999, 09:16 AM
Try this,
Private Sub Form_UnLoad()
Cancel = True
Me.Hide
End Sub
This will make the form impossible to close, and changes the "X" to act as a hide button.
Add a little extra code, in the form of a boolean, to allow the form to unload when you are exiting the program.
Something like
Private Sub Form_UnLoad()
If Not booExiting then Cancel = True
Me.Hide
End Sub
Where booExiting is set True by the Main form exit location.
Hope this helps,
Steve.
funkheads
Dec 5th, 1999, 09:48 PM
here is a response i think you are looking for:
in a .bas module:
Public Const MF_INSERT = &H0&
Public Const MF_REMOVE = &H1000&
Public Const SC_CLOSE = &HF060
Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Declare Function InsertMenu Lib "user32" Alias "InsertMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
then in the form_load proeedure:
RemoveMenu GetSystemMenu(hwnd, 0), SC_CLOSE, MF_REMOVE
if you want to put it back later, i have added the MF_INSERT constant for you in the public declarations section. just replace MF_REMOVE with it. happy programming!!
--michael
deDogs
Dec 6th, 1999, 06:17 AM
Thanks for all the information.
Thanks,
deDogs
vijivijay
Mar 30th, 2004, 11:34 PM
Hi
It doesn't work. the Removemenu makes the "X" button disable but not remove it.
dis1411
Mar 30th, 2004, 11:52 PM
what's the difference?
BuggyProgrammer
Mar 30th, 2004, 11:57 PM
Yes, why do you NEED to make it disappear?
agmorgan
Mar 31st, 2004, 02:01 AM
wasnt this thread started 5 years ago?
Madboy
Mar 31st, 2004, 03:32 AM
cant you use the vbCode Tags?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.