Retrieves the name of the event's parameter.
Type | Description | |||
String | A string expression that indicates the name of the event's parameter. |
Private Sub Grid1_ItemOleEvent(ByVal Item As EXGRIDLibCtl.HITEM, ByVal Ev As EXGRIDLibCtl.IOleEvent) Debug.Print "Event name:" & Ev.Name If (Ev.CountParam = 0) Then Debug.Print "The event has no arguments." Else Debug.Print "The event has the following arguments:" Dim i As Long For i = 0 To Ev.CountParam - 1 Debug.Print Ev(i).Name; " = " & Ev(i).Value Next End If End Sub
The following VB sample displays information about the fired event when the UserEditorOleEvent event occurs:
Private Sub Grid1_UserEditorOleEvent(ByVal Object As Object, ByVal Ev As EXGRIDLibCtl.IOleEvent, CloseEditor As Boolean, ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long) Debug.Print "Event name:" & Ev.Name If (Ev.CountParam = 0) Then Debug.Print "The event has no arguments." Else Debug.Print "The event has the following arguments:" Dim i As Long For i = 0 To Ev.CountParam - 1 Debug.Print Ev(i).Name; " = " & Ev(i).Value Next End If End Sub
The following VC sample displays the events that an ActiveX control is firing while it is hosted by an item:
#import <exgrid.dll> rename( "GetItems", "exGetItems" ) static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") ) { if ( pv ) { if ( pv->vt == VT_ERROR ) return szDefault; COleVariant vt; vt.ChangeType( VT_BSTR, pv ); return V_BSTR( &vt ); } return szDefault; } void OnItemOleEventGrid1(long Item, LPDISPATCH Ev) { EXGRIDLib::IOleEventPtr spEvent( Ev ); CString strOutput; strOutput.Format( "Event's name: %s\n", spEvent->Name.operator const char *() ); OutputDebugString( strOutput ); if ( spEvent->CountParam == 0 ) OutputDebugString( "The event has no parameters." ); else { for ( long i = 0; i < spEvent->CountParam; i++ ) { EXGRIDLib::IOleEventParamPtr spParam = spEvent->GetParam( COleVariant( i ) ); strOutput.Format( "Name: %s, Value: %s\n", spParam->Name.operator const char *(), V2S( &spParam->Value ) ); OutputDebugString( strOutput ); } } OutputDebugString( "" ); }
The #import clause is required to get the wrapper classes for IOleEvent and IOleEventParam objects, that are not defined by the MFC class wizard. The same #import statement defines the EXGRIDLib namespace that include all objects and types of the control's TypeLibrary. In case your exgrid.dll library is located to another place than the system folder or well known path, the path to the library should be provided, in order to let the VC finds the type library.
The following C++ sample displays the event and its parameters when an user editor object fires an event:
void OnUserEditorOleEventGrid1(LPDISPATCH Object, LPDISPATCH Ev, BOOL FAR* CloseEditor, long Item, long ColIndex) { EXGRIDLib::IOleEventPtr spEvent( Ev ); CString strOutput; strOutput.Format( "Event's name: %s\n", spEvent->Name.operator const char *() ); OutputDebugString( strOutput ); if ( spEvent->CountParam == 0 ) OutputDebugString( "The event has no parameters." ); else { for ( long i = 0; i < spEvent->CountParam; i++ ) { EXGRIDLib::IOleEventParamPtr spParam = spEvent->GetParam( COleVariant( i ) ); strOutput.Format( "Name: %s, Value: %s\n", spParam->Name.operator const char *(), V2S( &spParam->Value ) ); OutputDebugString( strOutput ); } } OutputDebugString( "" ); }
The following VB.NET sample displays the events that an ActiveX control is firing while it is hosted by an item:
Private Sub AxGrid1_ItemOleEvent(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_ItemOleEventEvent) Handles AxGrid1.ItemOleEvent Debug.WriteLine("Event's name: " & e.ev.Name) Dim i As Long For i = 0 To e.ev.CountParam - 1 Dim eP As EXGRIDLib.OleEventParam eP = e.ev(i) Debug.WriteLine("Name: " & e.ev.Name & " Value: " & eP.Value) Next End Sub
The following VB.NET sample displays the event and its parameters when an user editor object fires an event:
Private Sub AxGrid1_UserEditorOleEvent(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent) Handles AxGrid1.UserEditorOleEvent Debug.WriteLine("Event's name: " & e.ev.Name) Dim i As Long For i = 0 To e.ev.CountParam - 1 Dim eP As EXGRIDLib.OleEventParam eP = e.ev(i) Debug.WriteLine("Name: " & e.ev.Name & " Value: " & eP.Value) Next End Sub
The following C# sample displays the events that an ActiveX control is firing while it is hosted by an item:
private void axGrid1_ItemOleEvent(object sender, AxEXGRIDLib._IGridEvents_ItemOleEventEvent e) { System.Diagnostics.Debug.WriteLine( "Event's name: " + e.ev.Name.ToString() ); for ( int i= 0; i < e.ev.CountParam ; i++ ) { EXGRIDLib.IOleEventParam evP = e.ev[i]; System.Diagnostics.Debug.WriteLine( "Name: " + evP.Name.ToString() + ", Value: " + evP.Value.ToString() ); } }
The following C# sample displays the event and its parameters when an user editor object fires an event:
private void axGrid1_UserEditorOleEvent(object sender, AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent e) { System.Diagnostics.Debug.WriteLine("Event's name: " + e.ev.Name.ToString()); for (int i = 0; i < e.ev.CountParam; i++) { EXGRIDLib.IOleEventParam evP = e.ev[i]; System.Diagnostics.Debug.WriteLine("Name: " + evP.Name.ToString() + ", Value: " + evP.Value.ToString()); } }
The following VFP sample displays the events that an ActiveX control fires when it is hosted by an item ( ItemOleEvent event ):
*** ActiveX Control Event *** LPARAMETERS item, ev local s s = "Event's name: " + ev.Name for i = 0 to ev.CountParam - 1 s = s + "Name: " + ev.Param(i).Name + " ,Value: " + Str(ev.Param(i).Value) endfor wait window nowait s
The following VFP sample displays the event and its parameters when an user editor object fires an event ( UserEditorOleEvent event ):
*** ActiveX Control Event *** LPARAMETERS object, ev, closeeditor, item, colindex local s s = "Event's name: " + ev.Name for i = 0 to ev.CountParam - 1 s = s + "Name: " + ev.Param(i).Name + " ,Value: " + Str(ev.Param(i).Value) endfor wait window nowait s