Skip to Content

How can I add ItemEvent in C# by using visual studio, SAP B1?

Hi all,

I tried to change the title of Sales Blanket Agreement form to Investment in SDK by using visual basic but the helped codes I got are in C#, I am not good in C#.

How can I add ItemEvent in C# in order to use below codes for changing form title.

On your ItemEvent, add the code below:

if(pVal.BeforeAction && pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD && pVal.FormTypeEx == "1250000100")
{
       SAPbouiCOM.Form oForm = SBO_Application.Forms.Item(FormUID);
       oForm.Title = "Investment";
}<br>

I tried to search how I can add ItemEvent in C# but there is no success.

Please anyone can help me

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 04, 2017 at 04:02 PM

    Hi Rurangwa,

    Your application should have only code in unique language or C# or VB. You can easily convert the code above from C# to VB with http://converter.telerik.com/.

    The code converted to VB:

    If pVal.BeforeAction AndAlso pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD AndAlso pVal.FormTypeEx = "1250000100" Then
    	Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.Item(FormUID)
    	oForm.Title = "Investment"
    End If
    

    About how to use ItemEvent you can see the samples provided on the SDK folder.

    C#:

    C:\Program Files (x86)\SAP\SAP Business One SDK\Samples\COM UI\CSharp\11.SystemFormManipulation

    VB:

    C:\Program Files (x86)\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\11.SystemFormManipulation

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded