Skip to Content
0
Dec 04, 2009 at 03:17 AM

B1DE 2.0 - Stop before form unload event

36 Views

Hi All,

I am using B1DE2.0 to generate my addon.

Using below Code

        <B1Listener(BoEventTypes.et_FORM_UNLOAD, True)> _
        Public Overridable Function OnBeforeFormUnLoad(ByVal pVal As ItemEvent) As Boolean
            Dim form As SAPbouiCOM.Form = B1Connections.theAppl.Forms.Item(pVal.FormUID)
                    If form.Mode = BoFormMode.fm_UPDATE_MODE Then
                        If SBO_Application.MessageBox("Unsaved changes will be lost. Do you want to continue ?", 1, "Ok", "Cancel") = 2 Then
                            Return False
                        End If
                    End If
            End Select
            
            Return True
        End Function

I cannot stop the form from closing. Eventhough I have the above function has already return false.

Is there any wrong or is it really that form_unload event is not stopable ?

Regards

Edy