473,699 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File/Exit howto

Hi,

What is the standard code for closing down an application?.
Application.Exi t(); Works fine but I'm worried that its not the same as the eventhandler created by the ide for closing down an app. If I make an menu item File->Exit, I would like this to equivalate pressing the close form icon in the upper right corner. How do I link these two to run the same app shutdown code?

Nov 16 '05 #1
3 1703
Hi Jesper Denmark,

this.dispose();

Correct me if i am wrong. Cheers.
--
Regards,
Chua Wen Ching :)
"Jesper Denmark" wrote:
Hi,

What is the standard code for closing down an application?.
Application.Exi t(); Works fine but I'm worried that its not the same as the eventhandler created by the ide for closing down an app. If I make an menu item File->Exit, I would like this to equivalate pressing the close form icon in the upper right corner. How do I link these two to run the same app shutdown code?

Nov 16 '05 #2
Jesper Denmark wrote:
Hi,

What is the standard code for closing down an application?.
Application.Exi t(); Works fine but I'm worried that its not the same as the eventhandler created by the ide for closing down an app. If I make an menu item File->Exit, I would like this to equivalate pressing the close form icon in the upper right corner. How do I link these two to run the same app shutdown code?


I use this.Dispose().
"this" being the form that is open.

This is what MSDN says on Application.Exi t():

"This method stops all running message loops on all threads and closes
all windows of the application. This method does not force the
application to exit."

I think it does the job, you shouldn't worry about it.
It might be even better than Dispose() because it closes ALL windows,
dispose only closes one form.
Nov 16 '05 #3
Hi Nick,

Just curious,

If i had 2 forms.

FormA

FormB

FormA calls FormB, will close FormA, i use Application.Exi t()

Yeah, i agree. Everytime i call this.dispose(), it kills off my whole program.

Thanks for the highlight. Learn something today.
--
Regards,
Chua Wen Ching :)
"Nick" wrote:
Jesper Denmark wrote:
Hi,

What is the standard code for closing down an application?.
Application.Exi t(); Works fine but I'm worried that its not the same as the eventhandler created by the ide for closing down an app. If I make an menu item File->Exit, I would like this to equivalate pressing the close form icon in the upper right corner. How do I link these two to run the same app shutdown code?


I use this.Dispose().
"this" being the form that is open.

This is what MSDN says on Application.Exi t():

"This method stops all running message loops on all threads and closes
all windows of the application. This method does not force the
application to exit."

I think it does the job, you shouldn't worry about it.
It might be even better than Dispose() because it closes ALL windows,
dispose only closes one form.

Nov 16 '05 #4

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

Similar topics

4
2870
by: Josef Sachs | last post by:
Is Andrew Kuchling's regex-to-re HOWTO available anywhere? I've found the following (dead) links on various Web pages: http://py-howto.sourceforge.net/regex-to-re/regex-to-re.html http://starship.skyport.net/crew/amk/regex/regex-to-re.html http://www.python.org/doc/howto/regex-to-re/ http://www.amk.ca/python/howto/regex-to-re/ Thanks in advance.
2
1402
by: Matthew Thorley | last post by:
I wrote a simple python program that scrapes a web page every 30 secons and dumps the result in a data base. I want to use my linux distros build in init tools to run the script in the back ground as a daemon. The problem is when I call the daemon script to background the program I wrote it just hangs, waiting for my program to exit 1 or 0. My program never does exits because its looping every 30 seconds. Is there a way I can pass an...
5
7115
by: alejandro lapeyre | last post by:
How can I load / parse an HTML file with .NET? Thanks! Best regards, Alejandro Lapeyre
1
5384
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved completely/succsessfully on the client's computer before updating some metadata on the server (file downloaded date for instance) However, All examples i have tried, and all examples I have found that other people says works - doesn't work for me :-(
2
5042
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified folder structure and naming conventions and then send a Net send message to those users telling them to rectify. The information I want to get is when you select the file/folder and then: Properties -> Security Tab -> Advanced Button -> Owner Tab ->...
6
10211
by: Don | last post by:
I'm having problems working with a streamwriter object. After closing the streamwriter and setting it to Nothing, I try to delete the file it was writing to, but I always get the following error message: "The process cannot access the file "whatever" because it is being used by another process." I've even tried opening another file using the same streamwriter object before deleting the original file, but it's no use. Something keeps...
4
4191
by: pank7 | last post by:
hi everyone, I have a program here to test the file IO(actually output) with buffer turned on and off. What I want to see is that there will be obvious differece in time. Here I have an input file scales 1.1M, what I did is just copy it to another output file(ten times). But I don't think I see any difference. My file system is ext3, with debian sarge(kernel-2.6.8). Here is the main part of my program:
10
12026
by: Flex | last post by:
I have an application that use awt and Swing, with this code : public void windowClosing(WindowEvent e) { Window window = e.getWindow(); if (window.equals(this)) { setVisible(false); dispose(); } }
5
12726
by: Ouray Viney | last post by:
Hi All: I am looking at writing a python script that will let me parse a TestSuite xml file that contains n number of TestCases. My goal is to be able to count the <TestCaseelements base on a key value pair in the xml node. Example
0
8685
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
8613
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
9172
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
9032
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
8908
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
4374
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
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
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.