Handling the application.exit event

  • Thread starter Thread starter Johan
  • Start date Start date
J

Johan

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
 
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.enmAccountTypesDataServices.Title), _

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

If MyResult = MsgBoxResult.Yes Then

MyRow.Delete()

End If
 
Thank alot Ibrahim.


Johan

IbrahimMalluf said:
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.enmAccountTypesDataServices.Title), _

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

If MyResult = MsgBoxResult.Yes Then

MyRow.Delete()

End If
 
Back
Top