|
-
Dec 8th, 2006, 11:44 PM
#1
Thread Starter
Member
[RESOLVED] Exiting in C#
Okay, a pitifal question, but how do I exit my program when it's running? Same as the ext button on the Windows API does, but I have a menu item that I want to close the program.
I know in VB it's just "End", what is it in C#?
Thanks.
-
Dec 9th, 2006, 02:05 AM
#2
Re: Exiting in C#
It definitely SHOULDN'T be End in VB. Using End is a terrible way to exit an app because it simply halts execution immediately with no cleanup whatsoever. In both VB.NET and C#, as well as any other .NET language, you can simply call Me.Close if the form is the startup form. Otherwise you should call Application.Exit.
-
Dec 9th, 2006, 02:48 AM
#3
Re: Exiting in C#
There is no "End" in VB.NET, only in VB 6. Both VB.NET and C# use like what John posted.
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 
-
Dec 9th, 2006, 05:58 AM
#4
Thread Starter
Member
Re: Exiting in C#
Thanks guys, I have one problem, when I do the Me.Close or Application.Exit commands I get this error:
Code:
Only assignment, call, increment, decrement, and new object expressions can be used as a statement
-
Dec 9th, 2006, 09:09 AM
#5
Hyperactive Member
Re: Exiting in C#
yer you have to type this: application.exit();
you need the two brackets after exit
:-)
-
Dec 9th, 2006, 09:40 AM
#6
Thread Starter
Member
Re: Exiting in C#
Ah yes, that got it, thanks. .
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
|