|
-
Dec 5th, 1999, 02:33 AM
#1
Thread Starter
New Member
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
-
Dec 5th, 1999, 03:12 AM
#2
Hyperactive Member
Hi,
On the form properties change the ControlBox option to False. That will make all the buttons invisible.
-
Dec 5th, 1999, 07:08 AM
#3
Lively Member
-
Dec 5th, 1999, 10:16 AM
#4
Lively Member
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.
-
Dec 5th, 1999, 10:48 PM
#5
Lively Member
here is a response i think you are looking for:
in a .bas module:
Code:
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:
Code:
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
-
Dec 6th, 1999, 07:17 AM
#6
Thread Starter
New Member
Thanks for all the information.
Thanks,
deDogs
-
Mar 31st, 2004, 12:34 AM
#7
Junior Member
Hi
It doesn't work. the Removemenu makes the "X" button disable but not remove it.
-
Mar 31st, 2004, 12:52 AM
#8
Frenzied Member
-
Mar 31st, 2004, 12:57 AM
#9
The picture isn't missing
Yes, why do you NEED to make it disappear?
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Mar 31st, 2004, 03:01 AM
#10
Frenzied Member
wasnt this thread started 5 years ago?
-
Mar 31st, 2004, 04:32 AM
#11
Supreme User
cant you use the vbCode Tags?
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
|