473,834 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application.Exi t() did not exist the application.

Hi,
I used System.Windows. Forms.Applicati on.DoEvents() in a loop to handle user
click close button .

Private Sub btnclose_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnclose.Click
Me.Close()
System.Windows. Forms.Applicati on.Exit
End Sub

However, the application continues to run when user click close, thought the
form did close.

Is there anything I miss out?

Thanks.
Nov 20 '05 #1
22 2262
ah, good ol logic error.
Me.Close() did what it was supposed to. Closed the form and stopped execution
of the form along with it's resources.
The Application.Exi t command never got processed.
You could just remove the Me.Close().
If you want to make the form go away but continue to run, you might try
Me.Hide().
Then the Application.Exi t command should execute.
Although if your code was still running, this might not be the most graceful way
or appropriate place to exit.

Gerald

"Shelby" <sh****@itsuppo rt.com.sg> wrote in message
news:uy******** ******@TK2MSFTN GP09.phx.gbl...
Hi,
I used System.Windows. Forms.Applicati on.DoEvents() in a loop to handle user
click close button .

Private Sub btnclose_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnclose.Click
Me.Close()
System.Windows. Forms.Applicati on.Exit
End Sub

However, the application continues to run when user click close, thought the
form did close.

Is there anything I miss out?

Thanks.

Nov 20 '05 #2
Hi,
I have change to
Private Sub btnclose_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnclose.Click
System.Windows. Forms.Applicati on.Exit
End Sub

The application is still running and the form also close without the
me.close() statement.

"Cablewizar d" <Ca*********@Ya hoo.com> wrote in message
news:Os******** ********@TK2MSF TNGP12.phx.gbl. ..
ah, good ol logic error.
Me.Close() did what it was supposed to. Closed the form and stopped execution of the form along with it's resources.
The Application.Exi t command never got processed.
You could just remove the Me.Close().
If you want to make the form go away but continue to run, you might try
Me.Hide().
Then the Application.Exi t command should execute.
Although if your code was still running, this might not be the most graceful way or appropriate place to exit.

Gerald

"Shelby" <sh****@itsuppo rt.com.sg> wrote in message
news:uy******** ******@TK2MSFTN GP09.phx.gbl...
Hi,
I used System.Windows. Forms.Applicati on.DoEvents() in a loop to handle user click close button .

Private Sub btnclose_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnclose.Click
Me.Close()
System.Windows. Forms.Applicati on.Exit
End Sub

However, the application continues to run when user click close, thought the form did close.

Is there anything I miss out?

Thanks.


Nov 20 '05 #3
Just put a simple End in the Sub
Private Sub btnclose_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnclose.Click
End
End Sub
This Should do it.

Manny
"Shelby" <sh****@itsuppo rt.com.sg> wrote in message
news:uy******** ******@TK2MSFTN GP09.phx.gbl... Hi,
I used System.Windows. Forms.Applicati on.DoEvents() in a loop to handle user click close button .

Private Sub btnclose_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnclose.Click
Me.Close()
System.Windows. Forms.Applicati on.Exit
End Sub

However, the application continues to run when user click close, thought the form did close.

Is there anything I miss out?

Thanks.

Nov 20 '05 #4
Thank you...

"Manuel Canas" <mc*****@hotmai l.com> wrote in message
news:YzsEc.3894 0$_5.11257@clgr ps13...
Just put a simple End in the Sub
Private Sub btnclose_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnclose.Click


End
End Sub


This Should do it.

Manny
"Shelby" <sh****@itsuppo rt.com.sg> wrote in message
news:uy******** ******@TK2MSFTN GP09.phx.gbl...
Hi,
I used System.Windows. Forms.Applicati on.DoEvents() in a loop to handle

user
click close button .

Private Sub btnclose_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnclose.Click
Me.Close()
System.Windows. Forms.Applicati on.Exit
End Sub

However, the application continues to run when user click close, thought

the
form did close.

Is there anything I miss out?

Thanks.


Nov 20 '05 #5
Hi Shelby,

Using that *end* statement is worse than setting the power of from your
computer.

When the me.close is on the main form, that is normaly enough, you do not
need that application.exi t

However when it is not on the mainclass, you have normally to close in the
class where you started the application.

I hope this helps?

Cor
Nov 20 '05 #6

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:O0******** ******@tk2msftn gp13.phx.gbl...
Hi Shelby,

Using that *end* statement is worse than setting the power of from your
computer.


I am interesting in knowing why you think this?

Best Regards,
Andy
Nov 20 '05 #7
* "Andy Becker" <x@x.com> scripsit:
Using that *end* statement is worse than setting the power of from your
computer.


I am interesting in knowing why you think this?


<msdn>
The End statement can be placed anywhere in a procedure to end code
execution, close files opened with an Open statement, and clear
variables. The End statement calls the Exit method of the Environment
class in the System namespace. System.Environm ent.Exit requires that you
have SecurityPermiss ionFlag.Unmanag edCode permissions. If you do not, a
SecurityExcepti on error occurs.

When executed, the End statement clears all variables at module and
class level and all static local variables in all modules.

Note The End statement stops code execution abruptly, without invoking
the Finalize method or any other Visual Basic code. Object references
held by other programs are invalidated.

The End statement provides a way to force your program to halt. Your
program closes as soon as there are no other programs holding references
to its objects and none of its code is executing.

If your application has any forms open, you should close them before
executing End. A console application can either use End or simply return
from the Main procedure.
</msdn>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #8
> > Hi Shelby,

Using that *end* statement is worse than setting the power of from your
computer.


I am interesting in knowing why you think this?


Because it stops direct the program and does not free any resources anymore.
(It kills the process). When you power off than the resources are directly
freeed when you put the power on again.
Cor
Nov 20 '05 #9

"Manuel Canas" <mc*****@hotmai l.com> wrote in message
news:YzsEc.3894 0$_5.11257@clgr ps13...
Just put a simple End in the Sub
Private Sub btnclose_Click( ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnclose.Click


End


Oh man, that thing still exists in .NET?

And what's even worse is that people STILL suggest it!!
Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1600
by: -cicada- | last post by:
Excuse any errors in my description of the problem, as I'm only an amateur with Access. I've just created a simple VB application in A2000 that imports a text file into a table, and works fine. I then used the Microsoft Upsizing Wizard to create a new SQL database with an MS Access 2000 back end, and guess what, it not longer works, but stops at the line db.TableDefs.Delete ("tblData")
2
19797
by: Ramprasad A Padmanabhan | last post by:
If I have defined my main function as int Then does it make a difference I end main by return(0) or exit(0) Because I noticed that When My cgi program ended with exit(0) the program ended immediately else It would take long to exit long after return(0) was called Can anyone explain why this happens ( I am using apache on linux redhat 7.2)
4
48057
by: Rajesh Abraham | last post by:
I have a form, which is getting some settings from the App.config in the form load. If the Key doesn't exist, I need to close the application after trapping the error. I tried Application.Exit() and Form.Close() neither seems to be the right one. Thanks, Rajesh Abraham Chacko
3
1571
by: Mike Johnson | last post by:
I have the following code in form1 and when the application starts this sub is called to check for a path if not found a message box is displayed and then gives the user an option to end the application but when this option is selected the application does not end but continues to the next line of code which tries to setup a filewatcher with the path which does not exist, which then gives an error. please help. Public Sub Check_For_Dir()...
13
12510
by: Matthew | last post by:
Is there any difference between Application.Exit() and End? Are there circumstances when I should use one instead of the other? Matthew
2
2032
by: neilphan | last post by:
Hi Guys, I need a quick reference to Windows Application Development in dotNet. I'm fairly good at the Web Development using asp.net though i'm new to the Windows Desktop Application environment. For question would be how do you "Redirect" back and forth, from one Windows Desktop Form to another? In the web environment, it would be redirect(<page name>, <true/false to terminate the current page process>) but how do I do the same.
28
3817
by: gnuist006 | last post by:
I have some code like this: (if (test) (exit) (do something)) or (if (test)
11
2851
by: Rahul | last post by:
Hi Everyone, I have seen code in different styles like main(argc,argv) int argc; char **argv; { if(argc != 2) exit(1); else exit(0);
0
2071
by: Stephen Thomas | last post by:
Hi there I wonder if any one has encountered this problem or can suggest what is wrong. I am trying the a procedure from the msn site but get the following message: Error 1 The type or namespace name 'LiveSearch' does not exist in the namespace 'ConsoleSampleWebSearch' (are you missing an assembly reference?) C:\Documents and Settings\Compaq\Local Settings\Application Data\Temporary Projects\ConsoleSampleWebSearch\Program.cs 13 30...
0
9646
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10793
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10510
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6954
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5627
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5794
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3081
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.