Skip to Content
Former Member
May 24, 2005 at 12:59 AM

Unable to catch the form load event.



I am trying to catch the form load event for the Sales Quotation form.

My task is to add a new button when the form opens.

This is how my code looks -

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent

If pVal.FormType = 149 Then

If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then

' Add button on form load

oForm = SBO_Application.Forms.Item(FormUID)

oItem = oForm.Items.Add("Button", SAPbouiCOM.BoFormItemTypes.it_BUTTON)

oItem.Left = 140

oItem.Width = 65

oItem.Top = oForm.ClientHeight - 30

oItem.Height = 19

oButton = oItem.Specific

oButton.Caption = "Button"

End If

End If

End Sub

But the form load event never occurs and thus my code is not executed. SBO_Application_ItemEvent is not called when the form is opening.

I am able to catch the click events on the form.

What am I missing?

Please help me solve this issue.

Thank you for your help.