|
-
Nov 1st, 2005, 08:30 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Programing the X (exit) button
Hello,
In the Right hand top corner of every page is a X (Exit) button.
Is there anyway to program the code for this?
The reason I ask is because when I click it (On my program's window) It closes the app BUT does not close it in the Taskmanager window.
Thank you for any help you may have!
Stilekid007
 Originally Posted by stilekid007
-
Nov 1st, 2005, 08:36 PM
#2
Re: Programing the X (exit) button
If you have more than one form open you'd have to loop throyugh forms collection and close each form before you unload your main form. Also each form (upon closing) must destroy all object variables including (but not limited to) connection/recordsets/collections/etc...
VB Code:
Private Sub Form_Unload
Dim frm As Form
Form Each frm In Form
If Not frm.name = Me.Name Then
Unload frm
End if
Next frm
End Sub
-
Nov 1st, 2005, 08:45 PM
#3
Thread Starter
Hyperactive Member
Re: Programing the X (exit) button
Ah,
I see,
Thank you for that information!
Stilekid007
 Originally Posted by stilekid007
-
Nov 1st, 2005, 09:14 PM
#4
Re: Programing the X (exit) button
You should actually use the queryunload event for unloading all forms to quit an app. This event is raised when you click on the x button.
VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 1st, 2005, 09:17 PM
#5
Re: Programing the X (exit) button
 Originally Posted by RobDog888
You should actually use the queryunload event for unloading all forms to quit an app. ...
Not necessary. It's mainly usefull if you don't want user to quit "prematurely"...
-
Nov 1st, 2005, 09:20 PM
#6
Re: Programing the X (exit) button
Not necessarily true as if the system shuts down unexpectedly you can catch it by evaluating the Unload Mode parameter. Same for Windows session ending and other events.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 1st, 2005, 09:22 PM
#7
Thread Starter
Hyperactive Member
Re: Programing the X (exit) button
Ok, Great!
Thank you so much guys!
Stilekid007
 Originally Posted by stilekid007
-
Nov 1st, 2005, 09:33 PM
#8
Re: Programing the X (exit) button
 Originally Posted by RobDog888
Not necessarily true as if the system shuts down unexpectedly you can catch it by evaluating the Unload Mode parameter. Same for Windows session ending and other events. 
It is true - if app is shut down "unexpectedly" then what do you care about QueryUnload mode ...
-
Nov 1st, 2005, 09:35 PM
#9
Re: [RESOLVED] Programing the X (exit) button
Like if you have an open connection to an Access database which when unexpedly terminated can cause databaase corruption.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 1st, 2005, 09:39 PM
#10
Re: [RESOLVED] Programing the X (exit) button
Common really... terminating application/connection doesn't cause any corruption ... are you kidding me?
-
Nov 1st, 2005, 09:43 PM
#11
Re: [RESOLVED] Programing the X (exit) button
Obviously you havent worked with as many Access dbs as I have. I have seen it happen several times over the past few years. Now granted it may not happen every single time but if you dont have a backup and cant repair the db after a corruption, I'll bet you will wish you would have done all you could have to protected it instead of loosing your db and data.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 1st, 2005, 09:54 PM
#12
Re: [RESOLVED] Programing the X (exit) button
 Originally Posted by RobDog888
[color=navy]Obviously you havent worked with as many Access dbs as I have. ...
Not to offend you but you havent even seen that many yet. 
But I wish we can stop this quite useless conversation. Sorry.
-
Nov 1st, 2005, 09:57 PM
#13
Re: [RESOLVED] Programing the X (exit) button
same here.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
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
|