# EventCallback delegate

The EventCallback delegate is called as a parameter of the EnableEvent() method. A delegate is a data structure that refers either to a static method, or to a class instance and an instance method of that class.

You create the data structure using the prototype shown below. You call the delegate by passing either its address or a pointer to the delegate to the callbackFunc parameter of the EnableEvent() method.

## Prototype

VB .NET

Public Sub MyCallback(ByVal BoardNum As Integer, ByVal EventType As MccDaq.EventType, ByVal EventData As UInt32, ByVal pUserData As System.IntPtr)

C# .NET

public delegate void EventCallback(int BoardNum, MccDaq.EventType EventType, uint EventData, IntPtr pUserData);

## Parameters

BoardNum

Indicates which board caused the event.

EventType

Indicates which event occurred.

EventData

Board-specific data associated with this event. Returns the value of the EventType as listed in the "EventData parameter values" section below.

pUserData

Pointer to or reference of data supplied by the userData parameter in the EnableEvent() method. Note that before using this parameter value, it must be cast to the same data type as it was passed to EnableEvent().

## Returns

- pUserData – Returns the value specified by the userData parameter in EnableEvent().

### EventData parameter values

EventType | Value of EventData
OnDataAvailable | The number of samples acquired since the start of the scan.
OnEndOfInputScan | The total number of samples acquired upon the scan completion or end.
OnEndOfOutputScan | The total number of samples output upon the scan completion or end.
OnExternalInterrupt | The number of interrupts generated since enabling the OnExternalInterrupt event.
OnPretrigger | The number of pretrigger samples available at the time of pretrigger. Value is invalid for some boards when a TOOFEW error occurs. See board details.
OnScanError | The Error code of the scan error.