event Event (EventID as Long)
Notifies the application once the control fires an event.

TypeDescription
EventID as Long A Long expression that specifies the identifier of the event. Use the EventParam(-2) to display entire information about fired event ( such as name, identifier, and properties ).
The Event notification occurs ANY time the control fires an event. 

This is useful for X++ language, which does not support event with parameters passed by reference.

In X++ the "Error executing code: FormActiveXControl (data source), method ... called with invalid parameters" occurs when handling events that have parameters passed by reference. Passed by reference, means that in the event handler, you can change the value for that parameter, and so the control will takes the new value, and use it. The X++ is NOT able to handle properly events with parameters by reference, so we have the solution. 

The solution is using and handling the Event notification and EventParam method., instead handling the event that gives the "invalid parameters" error executing code.

Let's presume that we need to handle the BarParentChange event to change the _Cancel parameter from false to true, which fires the "Error executing code: FormActiveXControl (data source), method onEvent_BarParentChange called with invalid parameters." We need to know the identifier of the BarParentChange event ( each event has an unique identifier and it is static, defined in the control's type library ). If you are not familiar with what a type library means just handle the Event of the control as follows:

// Notifies the application once the control fires an event.
void onEvent_Event(int _EventID)
{
	print thumbnail1.EventParam(-2).toString();
}

This code allows you to display the information for each event of the control being fired as in the list bellow:

OLEGiveFeedback/1004( 1 , =true )
OLEDragDrop/1001( [Object] , =1 , 0 , 0 , 177 , 141 )
OLECompleteDrag/1003( 1 )
MouseMove/-606( 0 , 0 , 177 , 141 )
MouseMove/-606( 0 , 0 , 178 , 139 )

Each line indicates an event, and the following information is provided:  the name of the event, its identifier, and the list of parameters being passed to the event. The parameters that starts with = character, indicates a parameter by reference, in other words one that can be changed during the event handler.

Syntax for Event event, /NET version, on:

private void Event(object sender,int EventID)
{
}

Private Sub Event(ByVal sender As System.Object,ByVal EventID As Integer) Handles Event
End Sub

Syntax for Event event, /COM version, on:

private void Event(object sender, AxEXTHUMBNAILLib._IThumbnailEvents_EventEvent e)
{
}

void OnEvent(long EventID)
{
}

void __fastcall Event(TObject *Sender,long EventID)
{
}

procedure Event(ASender: TObject; EventID : Integer);
begin
end;

procedure Event(sender: System.Object; e: AxEXTHUMBNAILLib._IThumbnailEvents_EventEvent);
begin
end;

begin event Event(long EventID)
end event Event

Private Sub Event(ByVal sender As System.Object, ByVal e As AxEXTHUMBNAILLib._IThumbnailEvents_EventEvent) Handles Event
End Sub

Private Sub Event(ByVal EventID As Long)
End Sub

Private Sub Event(ByVal EventID As Long)
End Sub

LPARAMETERS EventID

PROCEDURE OnEvent(oThumbnail,EventID)
RETURN

Syntax for Event event, /COM version (others), on:

<SCRIPT EVENT="Event(EventID)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function Event(EventID)
End Function
</SCRIPT>

Procedure OnComEvent Integer llEventID
	Forward Send OnComEvent llEventID
End_Procedure

METHOD OCX_Event(EventID) CLASS MainDialog
RETURN NIL

void onEvent_Event(int _EventID)
{
}

function Event as v (EventID as N)
end function

function nativeObject_Event(EventID)
return