property NETHostCtrl.HostEvents as String
Specifies the list of events to be handled through the control's Event event, else all events are handled ( missing or not set ).

TypeDescription
String A String expression that specifies the list of events to be handled through the control's Event event, else all events are handled ( missing or not set ). The list of events is separated by any of the following characters: ' ', ',', '.', ':', '\t'
By default, the HostEvents property is empty, which indicates that all events of the hosting event are fired through the NETHost's HostEvent event. The HostEvent event notifies your application once the hosting control ( Host ) fires an event. The HostEvents property of the NETHost control specifies the list of events that the control should handle. The AsString property of the NETHostEvent object gives a brief description of the event that occurred including the event's name, identifier and its list of arguments. Each control that the NETHost host provides its own events, so for what events the hosting control supports consult its documentation.

Use the following properties to identify/filter the event:

The following samples filter for "AfterSelect" event of a TreeView control.

VBA (MS Access, Excell...)

' HostEvent event - The hosting control fires an event.
Private Sub NETHost1_HostEvent(ByVal Ev As Object)
	With NETHost1
		Debug.Print( Ev.AsString() )
	End With
End Sub

With NETHost1
	.HostEvents = "AfterSelect"
	.AssemblyLocation = "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
	.AssemblyName = "System.Windows.Forms.TreeView"
	With .Host
		With .Item("Nodes.Add(`Root 1`)")
			Set var_NETHostObject = .Item("Nodes.Add(`Child 1`)")
			Set var_NETHostObject1 = .Item("Nodes.Add(`Child 2`)")
			Set var_Object = .Item("Expand()")
		End With
	End With
End With

VB6

' HostEvent event - The hosting control fires an event.
Private Sub NETHost1_HostEvent(ByVal Ev As exontrol_NETHostCtl.INETHostEvent)
	With NETHost1
		Debug.Print( Ev.AsString() )
	End With
End Sub

With NETHost1
	.HostEvents = "AfterSelect"
	.AssemblyLocation = "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
	.AssemblyName = "System.Windows.Forms.TreeView"
	With .Host
		With .Item("Nodes.Add(`Root 1`)")
			Set var_NETHostObject = .Item("Nodes.Add(`Child 1`)")
			Set var_NETHostObject1 = .Item("Nodes.Add(`Child 2`)")
			Set var_Object = .Item("Expand()")
		End With
	End With
End With

VB.NET

' HostEvent event - The hosting control fires an event.
Private Sub Exnethost1_HostEvent(ByVal sender As System.Object,ByVal Ev As exontrol.exontrol_NETHost.NETHostEvent) Handles Exnethost1.HostEvent
	With Exnethost1
		Debug.Print( Ev.AsString() )
	End With
End Sub

Dim var_NETHostObject,var_NETHostObject1,var_Object
With Exnethost1
	.HostEvents = "AfterSelect"
	.AssemblyLocation = "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
	.AssemblyName = "System.Windows.Forms.TreeView"
	With .Host
		With .Item("Nodes.Add(`Root 1`)")
			var_NETHostObject = .Item("Nodes.Add(`Child 1`)")
			var_NETHostObject1 = .Item("Nodes.Add(`Child 2`)")
			var_Object = .Item("Expand()")
		End With
	End With
End With

VB.NET for /COM

' HostEvent event - The hosting control fires an event.
Private Sub AxNETHost1_HostEvent(ByVal sender As System.Object, ByVal e As Axexontrol_NETHost.INETHostCtrlEvents_HostEventEvent) Handles AxNETHost1.HostEvent
	With AxNETHost1
		Debug.Print( e.ev.AsString() )
	End With
End Sub

Dim var_NETHostObject,var_NETHostObject1,var_Object
With AxNETHost1
	.HostEvents = "AfterSelect"
	.AssemblyLocation = "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
	.AssemblyName = "System.Windows.Forms.TreeView"
	With .Host
		With .Item("Nodes.Add(`Root 1`)")
			var_NETHostObject = .Item("Nodes.Add(`Child 1`)")
			var_NETHostObject1 = .Item("Nodes.Add(`Child 2`)")
			var_Object = .Item("Expand()")
		End With
	End With
End With

C++

// HostEvent event - The hosting control fires an event.
void OnHostEventNETHost1(LPDISPATCH Ev)
{
	/*
		Copy and paste the following directives to your header file as
		it defines the namespace 'exontrol_NETHost' for the library: 'Exontrol NETHost ActiveX Component'
		#import <exontrol.NETHost.tlb>
	*/
	exontrol_NETHost::INETHostCtrlPtr spNETHost1 = GetDlgItem(IDC_NETHOST1)->GetControlUnknown();
	OutputDebugStringW( Ev.AsString() );
}

exontrol_NETHost::INETHostCtrlPtr spNETHost1 = GetDlgItem(IDC_NETHOST1)->GetControlUnknown();
spNETHost1->PutHostEvents(L"AfterSelect");
spNETHost1->PutAssemblyLocation(L"C:\\Windows\\assembly\\GAC_MSIL\\System.Windows.Forms\\2.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll");
spNETHost1->PutAssemblyName(L"System.Windows.Forms.TreeView");
exontrol_NETHost::INETHostObjectPtr var_NETHostObject = spNETHost1->GetHost();
	exontrol_NETHost::INETObjectTemplatePtr var_NETHostObject1 = var_NETHostObject->GetItem(L"Nodes.Add(`Root 1`)");
		exontrol_NETHost::INETObjectTemplatePtr var_NETHostObject = var_NETHostObject1->GetItem(L"Nodes.Add(`Child 1`)");
		var_NETHostObject1 = var_NETHostObject1->GetItem(L"Nodes.Add(`Child 2`)");
		ObjectPtr var_Object = ((ObjectPtr)(var_NETHostObject1->GetItem(L"Expand()")));

C++ Builder

// HostEvent event - The hosting control fires an event.
void __fastcall TForm1::NETHost1HostEvent(TObject *Sender,Exontrol_nethost_tlb::INETHostEvent *Ev)
{
	OutputDebugString( Ev.AsString() );
}

NETHost1->HostEvents = L"AfterSelect";
NETHost1->AssemblyLocation = L"C:\\Windows\\assembly\\GAC_MSIL\\System.Windows.Forms\\2.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll";
NETHost1->AssemblyName = L"System.Windows.Forms.TreeView";
Exontrol_nethost_tlb::INETHostObjectPtr var_NETHostObject = NETHost1->Host;
	Exontrol_nethost_tlb::INETObjectTemplatePtr var_NETHostObject1 = var_NETHostObject->get_Item(L"Nodes.Add(`Root 1`)");
		Exontrol_nethost_tlb::INETObjectTemplatePtr var_NETHostObject = var_NETHostObject1->get_Item(L"Nodes.Add(`Child 1`)");
		var_NETHostObject1 = var_NETHostObject1->get_Item(L"Nodes.Add(`Child 2`)");
		_tlb::ObjectPtr var_Object = var_NETHostObject1->get_Item(L"Expand()");

C#

// HostEvent event - The hosting control fires an event.
private void exnethost1_HostEvent(object sender,exontrol.exontrol_NETHost.NETHostEvent Ev)
{
	System.Diagnostics.Debug.Print( Ev.ToString() );
}
//this.exnethost1.HostEvent += new exontrol.exontrol_NETHost.exg2antt.HostEventEventHandler(this.exnethost1_HostEvent);

exnethost1.HostEvents = "AfterSelect";
exnethost1.AssemblyLocation = "C:\\Windows\\assembly\\GAC_MSIL\\System.Windows.Forms\\2.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll";
exnethost1.AssemblyName = "System.Windows.Forms.TreeView";
exontrol_NETHost.NETHostObject var_NETHostObject = exnethost1.Host;
	exontrol_NETHost.NETHostObject var_NETHostObject1 = var_NETHostObject["Nodes.Add(`Root 1`)"];
		exontrol_NETHost.NETHostObject var_NETHostObject = var_NETHostObject1["Nodes.Add(`Child 1`)"];
		var_NETHostObject1 = var_NETHostObject1["Nodes.Add(`Child 2`)"];
		Object var_Object = (var_NETHostObject1["Expand()"] as Object);

JScript/JavaScript

<BODY onload="Init()">
<SCRIPT FOR="NETHost1" EVENT="HostEvent(Ev)" LANGUAGE="JScript">
	alert( Ev.AsString() );
</SCRIPT>

<OBJECT CLASSID="clsid:FDCBA3E0-4E2F-4DC7-B073-EAA7BD7EC565" id="NETHost1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	NETHost1.HostEvents = "AfterSelect";
	NETHost1.AssemblyLocation = "C:\\Windows\\assembly\\GAC_MSIL\\System.Windows.Forms\\2.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll";
	NETHost1.AssemblyName = "System.Windows.Forms.TreeView";
	var var_NETHostObject = NETHost1.Host;
		var var_NETHostObject1 = var_NETHostObject.Item("Nodes.Add(`Root 1`)");
			var var_NETHostObject = var_NETHostObject1.Item("Nodes.Add(`Child 1`)");
			var_NETHostObject1 = var_NETHostObject1.Item("Nodes.Add(`Child 2`)");
			var var_Object = var_NETHostObject1.Item("Expand()");
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<SCRIPT LANGUAGE="VBScript">
Function NETHost1_HostEvent(Ev)
	With NETHost1
		alert( Ev.AsString() )
	End With
End Function
</SCRIPT>

<OBJECT CLASSID="clsid:FDCBA3E0-4E2F-4DC7-B073-EAA7BD7EC565" id="NETHost1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With NETHost1
		.HostEvents = "AfterSelect"
		.AssemblyLocation = "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
		.AssemblyName = "System.Windows.Forms.TreeView"
		With .Host
			With .Item("Nodes.Add(`Root 1`)")
				Set var_NETHostObject = .Item("Nodes.Add(`Child 1`)")
				Set var_NETHostObject1 = .Item("Nodes.Add(`Child 2`)")
				Set var_Object = .Item("Expand()")
			End With
		End With
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

// HostEvent event - The hosting control fires an event.
private void axNETHost1_HostEvent(object sender, Axexontrol_NETHost.INETHostCtrlEvents_HostEventEvent e)
{
	System.Diagnostics.Debug.Print( e.ev.ToString() );
}
//this.axNETHost1.HostEvent += new Axexontrol_NETHost.INETHostCtrlEvents_HostEventEventHandler(this.axNETHost1_HostEvent);

axNETHost1.HostEvents = "AfterSelect";
axNETHost1.AssemblyLocation = "C:\\Windows\\assembly\\GAC_MSIL\\System.Windows.Forms\\2.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll";
axNETHost1.AssemblyName = "System.Windows.Forms.TreeView";
exontrol_NETHost.NETHostObject var_NETHostObject = axNETHost1.Host;
	exontrol_NETHost.NETHostObject var_NETHostObject1 = var_NETHostObject["Nodes.Add(`Root 1`)"];
		exontrol_NETHost.NETHostObject var_NETHostObject = var_NETHostObject1["Nodes.Add(`Child 1`)"];
		var_NETHostObject1 = var_NETHostObject1["Nodes.Add(`Child 2`)"];
		Object var_Object = (var_NETHostObject1["Expand()"] as Object);

X++ (Dynamics Ax 2009)

// HostEvent event - The hosting control fires an event.
void onEvent_HostEvent(COM _Ev)
{
	;
	print( _Ev.AsString() );
}

public void init()
{
	COM com_NETHostObject,com_NETHostObject1,com_Object;
	anytype var_NETHostObject,var_NETHostObject1,var_Object;
	;

	super();

	exnethost1.HostEvents("AfterSelect");
	exnethost1.AssemblyLocation("C:\\Windows\\assembly\\GAC_MSIL\\System.Windows.Forms\\2.0.0.0__b77a5c561934e089\\System.Windows.Forms.dll");
	exnethost1.AssemblyName("System.Windows.Forms.TreeView");
	var_NETHostObject = exnethost1.Host(); com_NETHostObject = var_NETHostObject;
		var_NETHostObject1 = com_NETHostObject.Item("Nodes.Add(`Root 1`)"); com_NETHostObject1 = var_NETHostObject1;
			var_NETHostObject = COM::createFromObject(com_NETHostObject1.Item("Nodes.Add(`Child 1`)")); com_NETHostObject = var_NETHostObject;
			var_NETHostObject1 = COM::createFromObject(com_NETHostObject1.Item("Nodes.Add(`Child 2`)"));
			var_Object = COM::createFromObject(com_NETHostObject1.Item("Expand()")); com_Object = var_Object;
}

Delphi 8 (.NET only)

// HostEvent event - The hosting control fires an event.
procedure TWinForm1.AxNETHost1_HostEvent(sender: System.Object; e: Axexontrol_NETHost.INETHostCtrlEvents_HostEventEvent);
begin
	with AxNETHost1 do
	begin
		OutputDebugString( e.ev.AsString() );
	end
end;

with AxNETHost1 do
begin
	HostEvents := 'AfterSelect';
	AssemblyLocation := 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll';
	AssemblyName := 'System.Windows.Forms.TreeView';
	with Host do
	begin
		with Item['Nodes.Add(`Root 1`)'] do
		begin
			var_NETHostObject := Item['Nodes.Add(`Child 1`)'];
			var_NETHostObject1 := Item['Nodes.Add(`Child 2`)'];
			var_Object := (Item['Expand()'] as Object);
		end;
	end;
end

Delphi (standard)

// HostEvent event - The hosting control fires an event.
procedure TForm1.NETHost1HostEvent(ASender: TObject; Ev : INETHostEvent);
begin
	with NETHost1 do
	begin
		OutputDebugString( Ev.AsString() );
	end
end;

with NETHost1 do
begin
	HostEvents := 'AfterSelect';
	AssemblyLocation := 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll';
	AssemblyName := 'System.Windows.Forms.TreeView';
	with Host do
	begin
		with Item['Nodes.Add(`Root 1`)'] do
		begin
			var_NETHostObject := Item['Nodes.Add(`Child 1`)'];
			var_NETHostObject1 := Item['Nodes.Add(`Child 2`)'];
			var_Object := (IUnknown(Item['Expand()']) as _TLB.Object);
		end;
	end;
end

VFP

*** HostEvent event - The hosting control fires an event. ***
LPARAMETERS Ev
	with thisform.NETHost1
		DEBUGOUT( Ev.AsString() )
	endwith

with thisform.NETHost1
	.HostEvents = "AfterSelect"
	.AssemblyLocation = "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
	.AssemblyName = "System.Windows.Forms.TreeView"
	with .Host
		with .Item("Nodes.Add(`Root 1`)")
			var_NETHostObject = .Item("Nodes.Add(`Child 1`)")
			var_NETHostObject1 = .Item("Nodes.Add(`Child 2`)")
			var_Object = .Item("Expand()")
		endwith
	endwith
endwith

dBASE Plus

/*
with (this.ACTIVEX1.nativeObject)
	HostEvent = class::nativeObject_HostEvent
endwith
*/
// The hosting control fires an event.
function nativeObject_HostEvent(Ev)
	local oNETHost
	oNETHost = form.Activex1.nativeObject
	? Str(Ev.AsString()) 
return

local oNETHost,var_NETHostObject,var_NETHostObject1,var_Object

oNETHost = form.Activex1.nativeObject
oNETHost.HostEvents = "AfterSelect"
oNETHost.AssemblyLocation = "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
oNETHost.AssemblyName = "System.Windows.Forms.TreeView"
var_NETHostObject = oNETHost.Host
	var_NETHostObject1 = var_NETHostObject.Item("Nodes.Add(`Root 1`)")
		var_NETHostObject = var_NETHostObject1.Item("Nodes.Add(`Child 1`)")
		var_NETHostObject1 = var_NETHostObject1.Item("Nodes.Add(`Child 2`)")
		var_Object = var_NETHostObject1.Item("Expand()")

XBasic (Alpha Five)

' The hosting control fires an event.
function HostEvent as v (Ev as OLE::Exontrol.NETHost::INETHostEvent)
	Dim oNETHost as P
	oNETHost = topparent:CONTROL_ACTIVEX1.activex
	? Ev.AsString() 
end function

Dim oNETHost as P
Dim var_NETHostObject as P
Dim var_NETHostObject1 as P
Dim var_Object as P

oNETHost = topparent:CONTROL_ACTIVEX1.activex
oNETHost.HostEvents = "AfterSelect"
oNETHost.AssemblyLocation = "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
oNETHost.AssemblyName = "System.Windows.Forms.TreeView"
var_NETHostObject = oNETHost.Host
	var_NETHostObject1 = var_NETHostObject.Item("Nodes.Add(`Root 1`)")
		var_NETHostObject = var_NETHostObject1.Item("Nodes.Add(`Child 1`)")
		var_NETHostObject1 = var_NETHostObject1.Item("Nodes.Add(`Child 2`)")
		var_Object = var_NETHostObject1.Item("Expand()")

Visual Objects

METHOD OCX_Exontrol1HostEvent(Ev) CLASS MainDialog
	// HostEvent event - The hosting control fires an event.
	OutputDebugString(String2Psz( AsString(Ev.AsString()) ))
RETURN NIL

local var_NETHostObject as INETHostObject
local var_NETHostObject1 as INETObjectTemplate
local var_Object as USUAL

oDCOCX_Exontrol1:HostEvents := "AfterSelect"
oDCOCX_Exontrol1:AssemblyLocation := "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
oDCOCX_Exontrol1:AssemblyName := "System.Windows.Forms.TreeView"
var_NETHostObject := oDCOCX_Exontrol1:Host
	var_NETHostObject1 := var_NETHostObject:[Item,"Nodes.Add(`Root 1`)"]
		var_NETHostObject := var_NETHostObject1:[Item,"Nodes.Add(`Child 1`)"]
		var_NETHostObject1 := var_NETHostObject1:[Item,"Nodes.Add(`Child 2`)"]
		var_Object := var_NETHostObject1:[Item,"Expand()"]

PowerBuilder

/*begin event HostEvent(oleobject Ev) - The hosting control fires an event.*/
/*
	OleObject oNETHost
	oNETHost = ole_1.Object
	MessageBox("Information",string( String(Ev.AsString()) ))
*/
/*end event HostEvent*/

OleObject oNETHost,var_NETHostObject,var_NETHostObject1,var_Object

oNETHost = ole_1.Object
oNETHost.HostEvents = "AfterSelect"
oNETHost.AssemblyLocation = "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
oNETHost.AssemblyName = "System.Windows.Forms.TreeView"
var_NETHostObject = oNETHost.Host
	var_NETHostObject1 = var_NETHostObject.Item("Nodes.Add(`Root 1`)")
		var_NETHostObject = var_NETHostObject1.Item("Nodes.Add(`Child 1`)")
		var_NETHostObject1 = var_NETHostObject1.Item("Nodes.Add(`Child 2`)")
		var_Object = var_NETHostObject1.Item("Expand()")

Visual DataFlex

// The hosting control fires an event.
Procedure OnComHostEvent Variant llEv
	Forward Send OnComHostEvent llEv
	Showln llEv
End_Procedure

Procedure OnCreate
	Forward Send OnCreate
	Set ComHostEvents to "AfterSelect"
	Set ComAssemblyLocation to "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
	Set ComAssemblyName to "System.Windows.Forms.TreeView"
	Variant voNETHostObject
	Get ComHost to voNETHostObject
	Handle hoNETHostObject
	Get Create (RefClass(cComNETHostObject)) to hoNETHostObject
	Set pvComObject of hoNETHostObject to voNETHostObject
		Variant voNETHostObject1
		Get ComItem of hoNETHostObject "Nodes.Add(`Root 1`)" to voNETHostObject1
		Handle hoNETHostObject1
		Get Create (RefClass(cComNETHostObject)) to hoNETHostObject1
		Set pvComObject of hoNETHostObject1 to voNETHostObject1
			Variant var_NETHostObject
			Get ComItem of hoNETHostObject1 "Nodes.Add(`Child 1`)" to var_NETHostObject
			Variant var_NETHostObject1
			Get ComItem of hoNETHostObject1 "Nodes.Add(`Child 2`)" to var_NETHostObject1
			Variant var_Object
			Get ComItem of hoNETHostObject1 "Expand()" to var_Object
		Send Destroy to hoNETHostObject1
	Send Destroy to hoNETHostObject
End_Procedure

XBase++

PROCEDURE OnHostEvent(oNETHost,Ev)
	DevOut( Transform(Ev,"") )
RETURN

#include "AppEvent.ch"
#include "ActiveX.ch"

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oNETHostObject
	LOCAL oNETHostObject1,var_NETHostObject,var_NETHostObject1
	LOCAL oNETHost
	LOCAL var_Object

	oForm := XbpDialog():new( AppDesktop() )
	oForm:drawingArea:clipChildren := .T.
	oForm:create( ,,{100,100}, {640,480},, .F. )
	oForm:close  := {|| PostAppEvent( xbeP_Quit )}

	oNETHost := XbpActiveXControl():new( oForm:drawingArea )
	oNETHost:CLSID  := "Exontrol.NETHost" /*{FDCBA3E0-4E2F-4DC7-B073-EAA7BD7EC565}*/
	oNETHost:create(,, {10,60},{610,370} )

		oNETHost:HostEvent := {|Ev| OnHostEvent(oNETHost,Ev)} /*The hosting control fires an event.*/

		oNETHost:HostEvents := "AfterSelect"
		oNETHost:AssemblyLocation := "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
		oNETHost:AssemblyName := "System.Windows.Forms.TreeView"
		oNETHostObject := oNETHost:Host()
			oNETHostObject1 := oNETHostObject:Item("Nodes.Add(`Root 1`)")
				var_NETHostObject := oNETHostObject1:Item("Nodes.Add(`Child 1`)")
				var_NETHostObject1 := oNETHostObject1:Item("Nodes.Add(`Child 2`)")
				var_Object := oNETHostObject1:Item("Expand()")

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN