473,479 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Handling the application.exit event

hi,

I have an application with a parent and children forms for data entry. I
want to save any changes if the X is clicked before the application is
closed, but how do I do this?

I've read in this group that you can capture the Form_Closing event, but
from what I understand the child forms are closed before the parent form is
closed so capturing this in the parent form is too late. I also read about
using Application.Run in the Sub Main and I got this to show the parent
form, but I can't figure out how to capture the Application.Exit event here.

tia,

Johan
Nov 20 '05 #1
2 2273
Hello Johan

Use the _Closing event in each edit form to test for hanging edits and put
up a dialog to request adecision from the user if you want to give them that
choice, or just automatically make the updates before closing. The Code
below shows how to use a dialog to get a user's response:

Ibrahim

Dim MyRow As DataRow = MyTable.Rows(Me.DataGrid1.CurrentCell.RowNumber)

Dim MyResult As MsgBoxResult

MyResult = MsgBox("Are You sure You want to Delete " _

& MyRow.Item(MyAccountTypesDS.enmAccountTypesDataSer vices.Title), _

MsgBoxStyle.YesNo Or MsgBoxStyle.Question, "Deleteing Row")

If MyResult = MsgBoxResult.Yes Then

MyRow.Delete()

End If


"Johan" <jo***@vb.nets> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
hi,

I have an application with a parent and children forms for data entry. I
want to save any changes if the X is clicked before the application is
closed, but how do I do this?

I've read in this group that you can capture the Form_Closing event, but
from what I understand the child forms are closed before the parent form is closed so capturing this in the parent form is too late. I also read about
using Application.Run in the Sub Main and I got this to show the parent
form, but I can't figure out how to capture the Application.Exit event here.
tia,

Johan

Nov 20 '05 #2
Thank alot Ibrahim.
Johan

"IbrahimMalluf" <Ib*****@malluf.com> schreef in bericht
news:#5**************@TK2MSFTNGP10.phx.gbl...
Hello Johan

Use the _Closing event in each edit form to test for hanging edits and put
up a dialog to request adecision from the user if you want to give them that choice, or just automatically make the updates before closing. The Code
below shows how to use a dialog to get a user's response:

Ibrahim

Dim MyRow As DataRow = MyTable.Rows(Me.DataGrid1.CurrentCell.RowNumber)

Dim MyResult As MsgBoxResult

MyResult = MsgBox("Are You sure You want to Delete " _

& MyRow.Item(MyAccountTypesDS.enmAccountTypesDataSer vices.Title), _

MsgBoxStyle.YesNo Or MsgBoxStyle.Question, "Deleteing Row")

If MyResult = MsgBoxResult.Yes Then

MyRow.Delete()

End If


"Johan" <jo***@vb.nets> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
hi,

I have an application with a parent and children forms for data entry. I
want to save any changes if the X is clicked before the application is
closed, but how do I do this?

I've read in this group that you can capture the Form_Closing event, but
from what I understand the child forms are closed before the parent form

is
closed so capturing this in the parent form is too late. I also read about using Application.Run in the Sub Main and I got this to show the parent
form, but I can't figure out how to capture the Application.Exit event

here.

tia,

Johan


Nov 20 '05 #3

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

Similar topics

7
5958
by: Noor | last post by:
please tell the technique of centralize exception handling without try catch blocks in c#.
1
1917
by: sidd | last post by:
Hi all, how do i exit out(unload) of a windows service in case of an error. so i have a code block as follows try { } catch(exception ex) { //log to event log
4
2511
by: aaj | last post by:
Hi all I have an automated application, that runs in the middle of the night. If certain 'non system' errors occur (things like malformed files, missing files etc..), I send an automatic Email...
4
2700
by: ronenk | last post by:
I have this code to load an authentication form once my app is loaded. I want the authentication form to be closed if a user is authenticated successfully and to give the option to close app on his...
3
5011
by: orekinbck | last post by:
Hi There I'm probably missing something fundamental here but I don't understand the code in the OnThreadException routine, which is found in MSDN under the topic: Application.ThreadException...
8
1771
by: jcrouse | last post by:
I am using the following code to trap errors in a sub routine: Try Executable code Catch ex As Exception Dim strInputE As String = Application.StartupPath & "\Error.txt" Dim srE As...
5
3809
by: Bry | last post by:
I've created a class that offers an enhanced way of handling fatal exceptions. The class allows the user to optionaly submit a http based anonymous error report to myself, and also records details...
41
3020
by: Zytan | last post by:
Ok something simple like int.Parse(string) can throw these exceptions: ArgumentNullException, FormatException, OverflowException I don't want my program to just crash on an exception, so I must...
0
1060
by: divyesh1432 | last post by:
Hi buddy, I am having Sub Main (in module and it is start up object/form), which executes certain processes (exe). And after that I execute Application.Run() method which will keep my application...
0
7019
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,...
1
6719
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...
0
6847
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...
0
5312
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,...
0
4463
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...
0
2970
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1288
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 ...
1
555
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
166
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...

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.