|
-
Oct 29th, 2001, 08:56 AM
#1
Thread Starter
Fanatic Member
How do I get the "x" on the form to minimize the form instead of close it?
This would be very useful to know.
Any suggestion?
SeaHag
-
Oct 29th, 2001, 09:01 AM
#2
VB Code:
Private Sub Form_Unload(Cancel As Integer)
Cancel = -1
Form1.WindowState = vbMinimized
End Sub
-
Oct 29th, 2001, 09:02 AM
#3
Thread Starter
Fanatic Member
Cool thanks..
Could you tell me how that works?
Why -1?
-
Oct 29th, 2001, 09:05 AM
#4
-1 is True in VB so it tells the Form Unload to Cancel itself.
-
Oct 29th, 2001, 09:10 AM
#5
Hyperactive Member
Sorry guys, won't trapping & re-directing the Unload event of the form prevent it from unloading Ever Ever Ever ??
Pee

Best Bar.....
-
Oct 29th, 2001, 09:12 AM
#6
you can still end the program usind end and set form1 = nothing elsewhere
-
Oct 29th, 2001, 09:12 AM
#7
Thread Starter
Fanatic Member
I have a menu system.. seems to exit (end) alright
-
Oct 29th, 2001, 09:15 AM
#8
Hyperactive Member
I'm not causing problems here honest...
but wot if you did'nt want to End the Prog ? Just unload the Form ?? I suppose it can stay Minimised allright, not much overhead...

Best Bar.....
-
Oct 29th, 2001, 09:19 AM
#9
Thread Starter
Fanatic Member
I have the program in the task bar.
so I dont want people to Exit.

minimized property forces the program to the taskbar
-
Oct 29th, 2001, 10:01 AM
#10
Hyperactive Member
Ah yeah, Ok, I was just thinking out-loud really, in a different situation, trapping the Last event of the form could potentially cause infinite looping unless you Ended. Sorry for the annoyance.
Pee

Best Bar.....
-
Oct 29th, 2001, 10:04 AM
#11
Thread Starter
Fanatic Member
Np!!
I like ideas!
-
Oct 29th, 2001, 10:25 AM
#12
You should use the QueryUnload event instead of the Unload event.
VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbFormControlMenu Then
Cancel = True
Me.WindowState = vbMinimized
End If
End Sub
This will allow the form to be unloaded using the Unload FormName statement and also allowing Windows to terminate the application if someone closes Windows without first closing the application.
-
Oct 29th, 2001, 10:45 AM
#13
Thread Starter
Fanatic Member
Ok. Makes sense..
Thanks! all
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
|