property NETObjectTemplate.TemplateResult as NETObjectTemplate
Indicates the result of the last Template call.

TypeDescription
NETObjectTemplate A NETObjectTemplate object that holds the result of the last Template call.
The TemplateResult property returns the result of the last instruction into a Template call, as a NETObjectTemplate object. Use the Template/Item property to get/set properties / fields / parameters, invoke methods of the hosting /NET framework Value, using the x-script code. The Item property does exactly the same thing as Template call, excepts that it returns the TemplateResult property. For instance, using the Template/Item property you can change the hosting control's background color, add nodes, and so on. The TemplateThrowError property specifies whether the control fires an exception/error when the Template call fails. The TemplateError / TemplateException gets the error if the Template calls fails.

The following samples shows how you can use the Template and TemplateResult properties:

How can I use the TemplateResult property?

VBA (MS Access, Excell...)

With NETHost1
	.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
		.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
		.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"
	End With
End With

VB6

With NETHost1
	.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
		.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
		.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"
	End With
End With

VB.NET

With Exnethost1
	.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
		.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
		.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"
	End With
End With

VB.NET for /COM

With AxNETHost1
	.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
		.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
		.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"
	End With
End With

C++

/*
	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();
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::INETObjectTemplatePtr var_NETObjectTemplate = spNETHost1->GetHost();
	var_NETObjectTemplate->PutTemplate(L"Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }");
	var_NETObjectTemplate->GetTemplateResult()->PutTemplate(L"Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }");

C++ Builder

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::INETObjectTemplatePtr var_NETObjectTemplate = NETHost1->Host;
	var_NETObjectTemplate->Template = L"Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }";
	var_NETObjectTemplate->TemplateResult->Template = L"Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }";

C#

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.NETObjectTemplate var_NETObjectTemplate = exnethost1.Host;
	var_NETObjectTemplate.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }";
	var_NETObjectTemplate.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }";

JScript/JavaScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:FDCBA3E0-4E2F-4DC7-B073-EAA7BD7EC565" id="NETHost1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	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_NETObjectTemplate = NETHost1.Host;
		var_NETObjectTemplate.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }";
		var_NETObjectTemplate.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }";
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:FDCBA3E0-4E2F-4DC7-B073-EAA7BD7EC565" id="NETHost1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With NETHost1
		.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
			.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
			.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"
		End With
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

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.NETObjectTemplate var_NETObjectTemplate = axNETHost1.Host;
	var_NETObjectTemplate.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }";
	var_NETObjectTemplate.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }";

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_NETObjectTemplate,com_NETObjectTemplate1;
	anytype var_NETObjectTemplate,var_NETObjectTemplate1;
	;

	super();

	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_NETObjectTemplate = exnethost1.Host(); com_NETObjectTemplate = var_NETObjectTemplate;
		com_NETObjectTemplate.Template("Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }");
		var_NETObjectTemplate1 = COM::createFromObject(com_NETObjectTemplate.TemplateResult()); com_NETObjectTemplate1 = var_NETObjectTemplate1;
		com_NETObjectTemplate1.Template("Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }");
}

Delphi 8 (.NET only)

with AxNETHost1 do
begin
	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
		Template := 'Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }';
		TemplateResult.Template := 'Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }';
	end;
end

Delphi (standard)

with NETHost1 do
begin
	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
		Template := 'Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }';
		TemplateResult.Template := 'Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }';
	end;
end

VFP

with thisform.NETHost1
	.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
		.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
		.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"
	endwith
endwith

dBASE Plus

local oNETHost,var_NETObjectTemplate

oNETHost = form.Activex1.nativeObject
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_NETObjectTemplate = oNETHost.Host
	var_NETObjectTemplate.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
	var_NETObjectTemplate.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"

XBasic (Alpha Five)

Dim oNETHost as P
Dim var_NETObjectTemplate as P

oNETHost = topparent:CONTROL_ACTIVEX1.activex
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_NETObjectTemplate = oNETHost.Host
	var_NETObjectTemplate.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
	var_NETObjectTemplate.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"

Visual Objects

local var_NETObjectTemplate as INETObjectTemplate

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_NETObjectTemplate := oDCOCX_Exontrol1:Host
	var_NETObjectTemplate:Template := "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
	var_NETObjectTemplate:TemplateResult:Template := "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"

PowerBuilder

OleObject oNETHost,var_NETObjectTemplate

oNETHost = ole_1.Object
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_NETObjectTemplate = oNETHost.Host
	var_NETObjectTemplate.Template = "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
	var_NETObjectTemplate.TemplateResult.Template = "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	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 voNETObjectTemplate
	Get ComHost to voNETObjectTemplate
	Handle hoNETObjectTemplate
	Get Create (RefClass(cComNETObjectTemplate)) to hoNETObjectTemplate
	Set pvComObject of hoNETObjectTemplate to voNETObjectTemplate
		Set ComTemplate of hoNETObjectTemplate to "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
		Variant voNETObjectTemplate1
		Get ComTemplateResult of hoNETObjectTemplate to voNETObjectTemplate1
		Handle hoNETObjectTemplate1
		Get Create (RefClass(cComNETObjectTemplate)) to hoNETObjectTemplate1
		Set pvComObject of hoNETObjectTemplate1 to voNETObjectTemplate1
			Set ComTemplate of hoNETObjectTemplate1 to "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"
		Send Destroy to hoNETObjectTemplate1
	Send Destroy to hoNETObjectTemplate
End_Procedure

XBase++

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

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oNETObjectTemplate
	LOCAL oNETHost

	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:AssemblyLocation := "C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"
		oNETHost:AssemblyName := "System.Windows.Forms.TreeView"
		oNETObjectTemplate := oNETHost:Host()
			oNETObjectTemplate:Template := "Nodes.Add(`Root 1`){ BackColor = RGB(255,0,0);ForeColor = RGB(255,255,255) }"
			oNETObjectTemplate:TemplateResult():Template := "Nodes{ Add(`Child 1`); Add(`Child 2`) }; Expand() }"

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