GetData
The property returns a safearray of data that was append to the event when it was logged. The data can be included into the event message by the formatter. The data was append when the event was issued from the PLC function block (or other ADS device) or from a call to a Report Event Function like ITcEventLogC::ReportEvent,ITcEventC3::ReportEventEx or ITcEventLog::ReportEvent.
HRESULT GetData([in,out] SAFEARRAY(VARIANT)*
data);
Parameters
data |
[out, retval] Pointer to a safearray of variants that receives the event data
Return Values
S_OK
Function was successfully called
E_POINTER
data was no valid pointer.
Visual Basic sample code
' get the one and only event logger
Dim evtLogger As TCEVENTLOGGERLib.TcEventLog
Set evtLogger = New TCEVENTLOGGERLib.TcEventLog
' get the most recent active event
Dim evt As TcEvent
Set evt = evtLogger.GetLastEvent
' get the event data
Dim data() As Variant
Call evt.GetData(data)
' loop though the list of data
Dim i As Long
For i = LBound(data) To UBound(data)
Debug.Print data(i)
Next i