cancel
Showing results for 
Search instead for 
Did you mean: 

How to use LayoutKeyEvent in vb.net?

Former Member
0 Kudos

Hi All

     I'm trying to view my crystal report on my form but i stuck on how to Add Layout Key Event Handler.

     below is my code in vb.net. what is i missing?

     when i debug on line

     B1Connections.theAppl.LayoutKeyEvent = New _IApplicationEvents_LayoutKeyEventEventHandler(AddressOf theAppl_LayoutKeyEvent)

     It show error "Public member 'LayoutKeyEvent' on type 'ApplicationClass' not found."


     anyone please help me



<B1Listener(BoEventTypes.et_FORM_LOAD, False)> _

        Public Overridable Sub OnAfterFormLoad(ByVal pVal As ItemEvent)

            Dim ActionSuccess As Boolean = pVal.ActionSuccess

            Dim form As Form = B1Connections.theAppl.Forms.Item(pVal.FormUID)

            'ADD YOUR ACTION CODE HERE ...

            B1Connections.theAppl.LayoutKeyEvent = New _IApplicationEvents_LayoutKeyEventEventHandler(AddressOf theAppl_LayoutKeyEvent)

        End Sub

        Private Sub theAppl_LayoutKeyEvent(ByRef eventInfo As LayoutKeyInfo, ByRef BubbleEvent As Boolean)

            BubbleEvent = True

            eventInfo.LayoutKey = "1"

        End Sub

Thanks,

Vita

Accepted Solutions (0)

Answers (1)

Answers (1)

edy_simon
Active Contributor
0 Kudos

Hi Vita

    Private ThisFormEvent As SAPbouiCOM.EventForm = Nothing

    ThisFormEvent = SBO_Application.Forms.GetEventForm(ThisFormType)

    RemoveHandler ThisFormEvent.LayoutKeyBefore, AddressOf theAppl_LayoutKeyEvent

    AddHandler ThisFormEvent.LayoutKeyBefore, AddressOf theAppl_LayoutKeyEvent

Regards
Edy

Former Member
0 Kudos

Hi Simon

     I try your code It's not error but event 'LayoutKeyBefore' not fire when I print document.

What should i do next?

Thanks,

Vita

edy_simon
Active Contributor

Hi Vita,

Can you try :

1. Move the declaration of 'Private ThisFormEvent As SAPbouiCOM.EventForm = Nothing' as a global variable in your module as 'Public ThisFormEvent as SAPbouiCOM.EventForm'.

And Remove the declaration in this current class.


2. Have you set the oForm.ReportType property ? if you havent, set this during your initialization of this form.

Regards

Edy

Former Member
0 Kudos

Hi Edy,

     Sorry for late response.

     I declare 'Public ThisFormEvent As SAPbouiCOM.EventForm = Nothing' as global variable but it still not fire LayoutKeyBefore event.

      I Also try RemoveHandler,AddHandler with another event ex. closebefore , loadbefore etc. it work well except LayoutKeyBefore event.

And I already set form.reporttype property. What should i do next? Please help again.

Thanks in advance,

Vita

edy_simon
Active Contributor
0 Kudos

Hi Vita,

What is your B1 Version ?

Regards

Edy

Former Member
0 Kudos

Hi Edy,

     I'm using SAP 9.0 PL07.

Regards,

Vita

edy_simon
Active Contributor
0 Kudos

Hi Vita,

Can you try to upgrade to latest version first  and see ?

Regards

Edy