cancel
Showing results for 
Search instead for 
Did you mean: 

adding delegate to DataAddBefore

Former Member
0 Kudos

Hello,

my question is what the correct overload for this Event is?

I tried

DataAddBefore += this.OnFormDataAddBefore;

with

private void OnFormDataAddBefore(SBOItemEventArg e, out bool BubbleEvent)

        {

            BubbleEvent = true;

       

        }

But the compiler shows no matching overload....

but this is the delegate and I won't understand why this won't match???

public delegate void _IEventFormEvents_DataAddBeforeEventHandler(ref BusinessObjectInfo pVal, out bool BubbleEvent);



does anyone have an idea?


best regards

Oliver

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hello,

did you use the automatic generation of event code in visual studio? i mean using the tab key when you create events.

btw, here is the code i use. i think it's a matter of using the right arguments.

you are using SBOItemEventArg  instead of BusinessObjectInfo


public override void OnInitializeComponent()

{

     .....

      this.DataAddBefore += new DataAddBeforeHandler(fBusinessPartners_ValidationBeforeDataAddOrUpdate);

}

   void fBusinessPartners_ValidationBeforeDataAddOrUpdate(ref SAPbouiCOM.BusinessObjectInfo pVal, out bool BubbleEvent)

        {

            BubbleEvent = true;

            try

            {

               //do validation stuff

            }

            catch (Exception ex)

            {

                BubbleEvent = false;

                Application.SBO_Application.MessageBox(ex.Message);

            }

        }

hope it helps

Former Member
0 Kudos

Hi Christian,

no I Don't use the tab... because it won't work at my installation...

but anyway... with ref in front of BusinesobjectInfo it works...

Thanks.

Best regards

Oliver

Answers (0)