473,624 Members | 2,281 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 2238
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
1591
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
19785
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
48048
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
1543
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
12485
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
2025
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
3794
by: gnuist006 | last post by:
I have some code like this: (if (test) (exit) (do something)) or (if (test)
11
2833
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
2056
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
8242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8177
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
8681
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
8629
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...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4084
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...
1
2611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1488
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.