Hi Folks,
Going around in circles here. I have an Exit button (Barbuttonitem6) on my form and would like the FormClosing event to handle this. The code works fine for the FormClosing event but when i try to call the Formclosing event from Barbuttonitem6, it does not work (The form does not close if i choose Yes to save or No)
Any help appreciated.
Going around in circles here. I have an Exit button (Barbuttonitem6) on my form and would like the FormClosing event to handle this. The code works fine for the FormClosing event but when i try to call the Formclosing event from Barbuttonitem6, it does not work (The form does not close if i choose Yes to save or No)
Any help appreciated.
VB.NET:
Public Sub BarButtonItem6_ItemClick(ByVal sender As System.Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem6.ItemClick
Call EmployeeData_FormClosing(sender, Nothing)
End Sub
VB.NET:
Public Sub EmployeeData_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Select Case XtraMessageBox.Show("Do you wish to save before closing?", "Application Exit", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
Case DialogResult.Yes
'save code here
Me.D_PREVEMPEDHistoryTableAdapter.Update(Me.DsDPrevEmpEdHistory.D_PREVEMPEDHistory)
XtraMessageBox.Show("All records have now been saved successfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)
End If
Case Windows.Forms.DialogResult.No
'no code needed unless you want to do other
'things before closing the app instead of
'saving a file since we were already in the
'process of exiting the program
Case DialogResult.Cancel
If e IsNot Nothing Then
e.Cancel = True
End If
End Select
End Sub