property NETObjectTemplate.Item (Template as String) as NETObjectTemplate
Executes the template and returns the result.

TypeDescription
Template as String A String expression that specifies the x-script/template code to be executed.
NETObjectTemplate A NETObjectTemplate property that holds the result of the last instruction within the Template.
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. Prior to Template/Item call, you can invoke the SetTemplateDef to define values from your code to Template's code ( TemplateDef variables ).

in VB/NET under the .NET Framework, you use a code like follows to add nodes to a TreeView control:

With TreeView1
    With .Nodes.Add("Root 1")
        .Nodes.Add("Child 1")
        With .Nodes.Add("Child 2")
            .Nodes.Add("Sub-Child 2.1")
            .Nodes.Add("Sub-Child 2.2")
            .Nodes.Add("Sub-Child 2.3")
            .Expand()
        End With
        .Nodes.Add("Child 3")
        .Expand()
    End With
    With .Nodes.Add("Root 2")
        .Nodes.Add("Child 1")
        .Nodes.Add("Child 2")
        .Nodes.Add("Child 3")
    End With
End With

while on VB using the NETHost control you should use a code like:

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
        With .Item("Nodes.Add(`Root 1`)")
            .Template = "Nodes.Add(`Child 1`)"
            With .Item("Nodes.Add(`Child 2`)")
                .Template = "Nodes.Add(`Sub-Child 2.1`)"
                .Template = "Nodes.Add(`Sub-Child 2.2`)"
                .Template = "Nodes.Add(`Sub-Child 2.3`)"
                .Template = "Expand()"
            End With
            .Template = "Nodes.Add(`Child 3`)"
            .Template = "Expand()"
        End With
        With .Item("Nodes.Add(`Root 2`)")
            .Template = "Nodes.Add(`Child 1`)"
            .Template = "Nodes.Add(`Child 2`)"
            .Template = "Nodes.Add(`Child 3`)"
        End With
    End With
End With

The Template/ x-script code is a simple way of calling hosting control/object's properties, methods/ events using strings. Exontrol owns the x-script implementation in its easiest way and it does not require any VB engine to get executed. Our simple rule is using the component alone without any other dependency than the Windows system.

The Template/x-script syntax in BNF notation is defined like follows:

<x-script> := <lines>
<lines> := <line>[<eol> <lines>] | <block>
<block> := <call> [<eol>] { [<eol>] <lines> [<eol>] } [<eol>]
<eol> := ";" | "\r\n"
<line> := <dim> | <createobject> | <call> | <set> | <comment>
<dim> := "DIM" <variables>
<variables> := <variable> [, <variables>]
<variable> := "ME" | <identifier>
<createobject> := "CREATEOBJECT(`"<type>"`)"
<call> := <variable> | <property> | <variable>"."<property> | <createobject>"."<property>
<property> := [<property>"."]<identifier>["("<parameters>")"]
<set> := <call> "=" <value>
<property> := <identifier> | <identifier>"("[<parameters>]")"
<parameters> := <value> [","<parameters>]
<value> := <boolean> | <number> | <color> | <date> | <string> | <createobject> | <call>
<boolean> := "TRUE" | "FALSE"
<number> := "0X"<hexa> | ["-"]<integer>["."<integer>]
<digit10> := 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<digit16> := <digit10> | A | B | C | D | E | F
<integer> := <digit10>[<integer>]
<hexa> := <digit16>[<hexa>]
<color> := "RGB("<integer>","<integer>","<integer>")"
<date> := "#"<integer>"/"<integer>"/"<integer>" "[<integer>":"<integer>":"<integer>"]"#"
<string> := '"'<text>'"' | "`"<text>"`"
<comment> := "'"<text>

where:

<identifier> indicates an identifier of the variable, property or method, and should start with a letter.
<type> indicates the type the CreateObject function creates, as the assembly-qualified name of the type to create.
<text> any string of characters

The Template / x-script is composed by lines of instructions. Instructions are separated by "\r\n" ( new line characters ) or ";" character. 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 TemplateResult property returns the result of the last instruction into a Template call, as a NETObjectTemplate object.

An x-script instruction/line can be one of the following:

where

The x-script uses constant expressions as follows:

Also , the template or x-script code supports general functions as follows:

The following samples shows how you can use the Item 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
		With .Item("Nodes.Add(`Root 1`)")
			Set var_NETObjectTemplate = .Item("Nodes.Add(`Child 1`)")
			With .Item("Nodes.Add(`Child 2`)")
				Set var_NETObjectTemplate1 = .Item("Nodes.Add(`Sub-Child 2.1`)")
				Set var_NETObjectTemplate2 = .Item("Nodes.Add(`Sub-Child 2.2`)")
				Set var_NETObjectTemplate3 = .Item("Nodes.Add(`Sub-Child 2.3`)")
				Set var_Object = .Item("Expand()")
			End With
			Set var_NETObjectTemplate4 = .Item("Nodes.Add(`Child 3`)")
			Set var_Object1 = .Item("Expand()")
		End With
		With .Item("Nodes.Add(`Root 2`)")
			Set var_NETObjectTemplate5 = .Item("Nodes.Add(`Child 1`)")
			Set var_NETObjectTemplate6 = .Item("Nodes.Add(`Child 2`)")
			Set var_NETObjectTemplate7 = .Item("Nodes.Add(`Child 3`)")
		End With
	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
		With .Item("Nodes.Add(`Root 1`)")
			Set var_NETObjectTemplate = .Item("Nodes.Add(`Child 1`)")
			With .Item("Nodes.Add(`Child 2`)")
				Set var_NETObjectTemplate1 = .Item("Nodes.Add(`Sub-Child 2.1`)")
				Set var_NETObjectTemplate2 = .Item("Nodes.Add(`Sub-Child 2.2`)")
				Set var_NETObjectTemplate3 = .Item("Nodes.Add(`Sub-Child 2.3`)")
				Set var_Object = .Item("Expand()")
			End With
			Set var_NETObjectTemplate4 = .Item("Nodes.Add(`Child 3`)")
			Set var_Object1 = .Item("Expand()")
		End With
		With .Item("Nodes.Add(`Root 2`)")
			Set var_NETObjectTemplate5 = .Item("Nodes.Add(`Child 1`)")
			Set var_NETObjectTemplate6 = .Item("Nodes.Add(`Child 2`)")
			Set var_NETObjectTemplate7 = .Item("Nodes.Add(`Child 3`)")
		End With
	End With
End With

VB.NET

Dim var_NETObjectTemplate,var_NETObjectTemplate1,var_NETObjectTemplate2,var_NETObjectTemplate3,var_NETObjectTemplate4,var_NETObjectTemplate5,var_NETObjectTemplate6,var_NETObjectTemplate7,var_Object,var_Object1
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
		With .Item("Nodes.Add(`Root 1`)")
			var_NETObjectTemplate = .Item("Nodes.Add(`Child 1`)")
			With .Item("Nodes.Add(`Child 2`)")
				var_NETObjectTemplate1 = .Item("Nodes.Add(`Sub-Child 2.1`)")
				var_NETObjectTemplate2 = .Item("Nodes.Add(`Sub-Child 2.2`)")
				var_NETObjectTemplate3 = .Item("Nodes.Add(`Sub-Child 2.3`)")
				var_Object = .Item("Expand()")
			End With
			var_NETObjectTemplate4 = .Item("Nodes.Add(`Child 3`)")
			var_Object1 = .Item("Expand()")
		End With
		With .Item("Nodes.Add(`Root 2`)")
			var_NETObjectTemplate5 = .Item("Nodes.Add(`Child 1`)")
			var_NETObjectTemplate6 = .Item("Nodes.Add(`Child 2`)")
			var_NETObjectTemplate7 = .Item("Nodes.Add(`Child 3`)")
		End With
	End With
End With

VB.NET for /COM

Dim var_NETObjectTemplate,var_NETObjectTemplate1,var_NETObjectTemplate2,var_NETObjectTemplate3,var_NETObjectTemplate4,var_NETObjectTemplate5,var_NETObjectTemplate6,var_NETObjectTemplate7,var_Object,var_Object1
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
		With .Item("Nodes.Add(`Root 1`)")
			var_NETObjectTemplate = .Item("Nodes.Add(`Child 1`)")
			With .Item("Nodes.Add(`Child 2`)")
				var_NETObjectTemplate1 = .Item("Nodes.Add(`Sub-Child 2.1`)")
				var_NETObjectTemplate2 = .Item("Nodes.Add(`Sub-Child 2.2`)")
				var_NETObjectTemplate3 = .Item("Nodes.Add(`Sub-Child 2.3`)")
				var_Object = .Item("Expand()")
			End With
			var_NETObjectTemplate4 = .Item("Nodes.Add(`Child 3`)")
			var_Object1 = .Item("Expand()")
		End With
		With .Item("Nodes.Add(`Root 2`)")
			var_NETObjectTemplate5 = .Item("Nodes.Add(`Child 1`)")
			var_NETObjectTemplate6 = .Item("Nodes.Add(`Child 2`)")
			var_NETObjectTemplate7 = .Item("Nodes.Add(`Child 3`)")
		End With
	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();
	exontrol_NETHost::INETObjectTemplatePtr var_NETObjectTemplate1 = var_NETObjectTemplate->GetItem(L"Nodes.Add(`Root 1`)");
		exontrol_NETHost::INETObjectTemplatePtr var_NETObjectTemplate = var_NETObjectTemplate1->GetItem(L"Nodes.Add(`Child 1`)");
		exontrol_NETHost::INETObjectTemplatePtr var_NETObjectTemplate2 = var_NETObjectTemplate1->GetItem(L"Nodes.Add(`Child 2`)");
			var_NETObjectTemplate1 = var_NETObjectTemplate2->GetItem(L"Nodes.Add(`Sub-Child 2.1`)");
			var_NETObjectTemplate2 = var_NETObjectTemplate2->GetItem(L"Nodes.Add(`Sub-Child 2.2`)");
			exontrol_NETHost::INETObjectTemplatePtr var_NETObjectTemplate3 = var_NETObjectTemplate2->GetItem(L"Nodes.Add(`Sub-Child 2.3`)");
			ObjectPtr var_Object = ((ObjectPtr)(var_NETObjectTemplate2->GetItem(L"Expand()")));
		exontrol_NETHost::INETObjectTemplatePtr var_NETObjectTemplate4 = var_NETObjectTemplate1->GetItem(L"Nodes.Add(`Child 3`)");
		ObjectPtr var_Object1 = ((ObjectPtr)(var_NETObjectTemplate1->GetItem(L"Expand()")));
	exontrol_NETHost::INETObjectTemplatePtr var_NETObjectTemplate5 = var_NETObjectTemplate->GetItem(L"Nodes.Add(`Root 2`)");
		var_NETObjectTemplate5 = var_NETObjectTemplate5->GetItem(L"Nodes.Add(`Child 1`)");
		exontrol_NETHost::INETObjectTemplatePtr var_NETObjectTemplate6 = var_NETObjectTemplate5->GetItem(L"Nodes.Add(`Child 2`)");
		exontrol_NETHost::INETObjectTemplatePtr var_NETObjectTemplate7 = var_NETObjectTemplate5->GetItem(L"Nodes.Add(`Child 3`)");

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;
	Exontrol_nethost_tlb::INETObjectTemplatePtr var_NETObjectTemplate1 = var_NETObjectTemplate->get_Item(L"Nodes.Add(`Root 1`)");
		Exontrol_nethost_tlb::INETObjectTemplatePtr var_NETObjectTemplate = var_NETObjectTemplate1->get_Item(L"Nodes.Add(`Child 1`)");
		Exontrol_nethost_tlb::INETObjectTemplatePtr var_NETObjectTemplate2 = var_NETObjectTemplate1->get_Item(L"Nodes.Add(`Child 2`)");
			var_NETObjectTemplate1 = var_NETObjectTemplate2->get_Item(L"Nodes.Add(`Sub-Child 2.1`)");
			var_NETObjectTemplate2 = var_NETObjectTemplate2->get_Item(L"Nodes.Add(`Sub-Child 2.2`)");
			Exontrol_nethost_tlb::INETObjectTemplatePtr var_NETObjectTemplate3 = var_NETObjectTemplate2->get_Item(L"Nodes.Add(`Sub-Child 2.3`)");
			_tlb::ObjectPtr var_Object = var_NETObjectTemplate2->get_Item(L"Expand()");
		Exontrol_nethost_tlb::INETObjectTemplatePtr var_NETObjectTemplate4 = var_NETObjectTemplate1->get_Item(L"Nodes.Add(`Child 3`)");
		_tlb::ObjectPtr var_Object1 = var_NETObjectTemplate1->get_Item(L"Expand()");
	Exontrol_nethost_tlb::INETObjectTemplatePtr var_NETObjectTemplate5 = var_NETObjectTemplate->get_Item(L"Nodes.Add(`Root 2`)");
		var_NETObjectTemplate5 = var_NETObjectTemplate5->get_Item(L"Nodes.Add(`Child 1`)");
		Exontrol_nethost_tlb::INETObjectTemplatePtr var_NETObjectTemplate6 = var_NETObjectTemplate5->get_Item(L"Nodes.Add(`Child 2`)");
		Exontrol_nethost_tlb::INETObjectTemplatePtr var_NETObjectTemplate7 = var_NETObjectTemplate5->get_Item(L"Nodes.Add(`Child 3`)");

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;
	exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate1 = var_NETObjectTemplate["Nodes.Add(`Root 1`)"];
		exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate = var_NETObjectTemplate1["Nodes.Add(`Child 1`)"];
		exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate2 = var_NETObjectTemplate1["Nodes.Add(`Child 2`)"];
			var_NETObjectTemplate1 = var_NETObjectTemplate2["Nodes.Add(`Sub-Child 2.1`)"];
			var_NETObjectTemplate2 = var_NETObjectTemplate2["Nodes.Add(`Sub-Child 2.2`)"];
			exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate3 = var_NETObjectTemplate2["Nodes.Add(`Sub-Child 2.3`)"];
			Object var_Object = (var_NETObjectTemplate2["Expand()"] as Object);
		exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate4 = var_NETObjectTemplate1["Nodes.Add(`Child 3`)"];
		Object var_Object1 = (var_NETObjectTemplate1["Expand()"] as Object);
	exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate5 = var_NETObjectTemplate["Nodes.Add(`Root 2`)"];
		var_NETObjectTemplate5 = var_NETObjectTemplate5["Nodes.Add(`Child 1`)"];
		exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate6 = var_NETObjectTemplate5["Nodes.Add(`Child 2`)"];
		exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate7 = var_NETObjectTemplate5["Nodes.Add(`Child 3`)"];

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 var_NETObjectTemplate1 = var_NETObjectTemplate.Item("Nodes.Add(`Root 1`)");
			var var_NETObjectTemplate = var_NETObjectTemplate1.Item("Nodes.Add(`Child 1`)");
			var var_NETObjectTemplate2 = var_NETObjectTemplate1.Item("Nodes.Add(`Child 2`)");
				var_NETObjectTemplate1 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.1`)");
				var_NETObjectTemplate2 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.2`)");
				var var_NETObjectTemplate3 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.3`)");
				var var_Object = var_NETObjectTemplate2.Item("Expand()");
			var var_NETObjectTemplate4 = var_NETObjectTemplate1.Item("Nodes.Add(`Child 3`)");
			var var_Object1 = var_NETObjectTemplate1.Item("Expand()");
		var var_NETObjectTemplate5 = var_NETObjectTemplate.Item("Nodes.Add(`Root 2`)");
			var_NETObjectTemplate5 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 1`)");
			var var_NETObjectTemplate6 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 2`)");
			var var_NETObjectTemplate7 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 3`)");
}
</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
			With .Item("Nodes.Add(`Root 1`)")
				Set var_NETObjectTemplate = .Item("Nodes.Add(`Child 1`)")
				With .Item("Nodes.Add(`Child 2`)")
					Set var_NETObjectTemplate1 = .Item("Nodes.Add(`Sub-Child 2.1`)")
					Set var_NETObjectTemplate2 = .Item("Nodes.Add(`Sub-Child 2.2`)")
					Set var_NETObjectTemplate3 = .Item("Nodes.Add(`Sub-Child 2.3`)")
					Set var_Object = .Item("Expand()")
				End With
				Set var_NETObjectTemplate4 = .Item("Nodes.Add(`Child 3`)")
				Set var_Object1 = .Item("Expand()")
			End With
			With .Item("Nodes.Add(`Root 2`)")
				Set var_NETObjectTemplate5 = .Item("Nodes.Add(`Child 1`)")
				Set var_NETObjectTemplate6 = .Item("Nodes.Add(`Child 2`)")
				Set var_NETObjectTemplate7 = .Item("Nodes.Add(`Child 3`)")
			End With
		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;
	exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate1 = var_NETObjectTemplate["Nodes.Add(`Root 1`)"];
		exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate = var_NETObjectTemplate1["Nodes.Add(`Child 1`)"];
		exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate2 = var_NETObjectTemplate1["Nodes.Add(`Child 2`)"];
			var_NETObjectTemplate1 = var_NETObjectTemplate2["Nodes.Add(`Sub-Child 2.1`)"];
			var_NETObjectTemplate2 = var_NETObjectTemplate2["Nodes.Add(`Sub-Child 2.2`)"];
			exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate3 = var_NETObjectTemplate2["Nodes.Add(`Sub-Child 2.3`)"];
			Object var_Object = (var_NETObjectTemplate2["Expand()"] as Object);
		exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate4 = var_NETObjectTemplate1["Nodes.Add(`Child 3`)"];
		Object var_Object1 = (var_NETObjectTemplate1["Expand()"] as Object);
	exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate5 = var_NETObjectTemplate["Nodes.Add(`Root 2`)"];
		var_NETObjectTemplate5 = var_NETObjectTemplate5["Nodes.Add(`Child 1`)"];
		exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate6 = var_NETObjectTemplate5["Nodes.Add(`Child 2`)"];
		exontrol_NETHost.NETObjectTemplate var_NETObjectTemplate7 = var_NETObjectTemplate5["Nodes.Add(`Child 3`)"];

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_NETObjectTemplate,com_NETObjectTemplate1,com_NETObjectTemplate2,com_NETObjectTemplate3,com_NETObjectTemplate4,com_NETObjectTemplate5,com_NETObjectTemplate6,com_NETObjectTemplate7,com_Object,com_Object1;
	anytype var_NETObjectTemplate,var_NETObjectTemplate1,var_NETObjectTemplate2,var_NETObjectTemplate3,var_NETObjectTemplate4,var_NETObjectTemplate5,var_NETObjectTemplate6,var_NETObjectTemplate7,var_Object,var_Object1;
	;

	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;
		var_NETObjectTemplate1 = com_NETObjectTemplate.Item("Nodes.Add(`Root 1`)"); com_NETObjectTemplate1 = var_NETObjectTemplate1;
			var_NETObjectTemplate = COM::createFromObject(com_NETObjectTemplate1.Item("Nodes.Add(`Child 1`)")); com_NETObjectTemplate = var_NETObjectTemplate;
			var_NETObjectTemplate2 = com_NETObjectTemplate1.Item("Nodes.Add(`Child 2`)"); com_NETObjectTemplate2 = var_NETObjectTemplate2;
				var_NETObjectTemplate1 = COM::createFromObject(com_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.1`)"));
				var_NETObjectTemplate2 = COM::createFromObject(com_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.2`)"));
				var_NETObjectTemplate3 = COM::createFromObject(com_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.3`)")); com_NETObjectTemplate3 = var_NETObjectTemplate3;
				var_Object = COM::createFromObject(com_NETObjectTemplate2.Item("Expand()")); com_Object = var_Object;
			var_NETObjectTemplate4 = COM::createFromObject(com_NETObjectTemplate1.Item("Nodes.Add(`Child 3`)")); com_NETObjectTemplate4 = var_NETObjectTemplate4;
			var_Object1 = COM::createFromObject(com_NETObjectTemplate1.Item("Expand()")); com_Object1 = var_Object1;
		var_NETObjectTemplate5 = com_NETObjectTemplate.Item("Nodes.Add(`Root 2`)"); com_NETObjectTemplate5 = var_NETObjectTemplate5;
			var_NETObjectTemplate5 = COM::createFromObject(com_NETObjectTemplate5.Item("Nodes.Add(`Child 1`)"));
			var_NETObjectTemplate6 = COM::createFromObject(com_NETObjectTemplate5.Item("Nodes.Add(`Child 2`)")); com_NETObjectTemplate6 = var_NETObjectTemplate6;
			var_NETObjectTemplate7 = COM::createFromObject(com_NETObjectTemplate5.Item("Nodes.Add(`Child 3`)")); com_NETObjectTemplate7 = var_NETObjectTemplate7;
}

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
		with Item['Nodes.Add(`Root 1`)'] do
		begin
			var_NETObjectTemplate := Item['Nodes.Add(`Child 1`)'];
			with Item['Nodes.Add(`Child 2`)'] do
			begin
				var_NETObjectTemplate1 := Item['Nodes.Add(`Sub-Child 2.1`)'];
				var_NETObjectTemplate2 := Item['Nodes.Add(`Sub-Child 2.2`)'];
				var_NETObjectTemplate3 := Item['Nodes.Add(`Sub-Child 2.3`)'];
				var_Object := (Item['Expand()'] as Object);
			end;
			var_NETObjectTemplate4 := Item['Nodes.Add(`Child 3`)'];
			var_Object1 := (Item['Expand()'] as Object);
		end;
		with Item['Nodes.Add(`Root 2`)'] do
		begin
			var_NETObjectTemplate5 := Item['Nodes.Add(`Child 1`)'];
			var_NETObjectTemplate6 := Item['Nodes.Add(`Child 2`)'];
			var_NETObjectTemplate7 := Item['Nodes.Add(`Child 3`)'];
		end;
	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
		with Item['Nodes.Add(`Root 1`)'] do
		begin
			var_NETObjectTemplate := Item['Nodes.Add(`Child 1`)'];
			with Item['Nodes.Add(`Child 2`)'] do
			begin
				var_NETObjectTemplate1 := Item['Nodes.Add(`Sub-Child 2.1`)'];
				var_NETObjectTemplate2 := Item['Nodes.Add(`Sub-Child 2.2`)'];
				var_NETObjectTemplate3 := Item['Nodes.Add(`Sub-Child 2.3`)'];
				var_Object := (IUnknown(Item['Expand()']) as _TLB.Object);
			end;
			var_NETObjectTemplate4 := Item['Nodes.Add(`Child 3`)'];
			var_Object1 := (IUnknown(Item['Expand()']) as _TLB.Object);
		end;
		with Item['Nodes.Add(`Root 2`)'] do
		begin
			var_NETObjectTemplate5 := Item['Nodes.Add(`Child 1`)'];
			var_NETObjectTemplate6 := Item['Nodes.Add(`Child 2`)'];
			var_NETObjectTemplate7 := Item['Nodes.Add(`Child 3`)'];
		end;
	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
		with .Item("Nodes.Add(`Root 1`)")
			var_NETObjectTemplate = .Item("Nodes.Add(`Child 1`)")
			with .Item("Nodes.Add(`Child 2`)")
				var_NETObjectTemplate1 = .Item("Nodes.Add(`Sub-Child 2.1`)")
				var_NETObjectTemplate2 = .Item("Nodes.Add(`Sub-Child 2.2`)")
				var_NETObjectTemplate3 = .Item("Nodes.Add(`Sub-Child 2.3`)")
				var_Object = .Item("Expand()")
			endwith
			var_NETObjectTemplate4 = .Item("Nodes.Add(`Child 3`)")
			var_Object1 = .Item("Expand()")
		endwith
		with .Item("Nodes.Add(`Root 2`)")
			var_NETObjectTemplate5 = .Item("Nodes.Add(`Child 1`)")
			var_NETObjectTemplate6 = .Item("Nodes.Add(`Child 2`)")
			var_NETObjectTemplate7 = .Item("Nodes.Add(`Child 3`)")
		endwith
	endwith
endwith

dBASE Plus

local oNETHost,var_NETObjectTemplate,var_NETObjectTemplate1,var_NETObjectTemplate2,var_NETObjectTemplate3,var_NETObjectTemplate4,var_NETObjectTemplate5,var_NETObjectTemplate6,var_NETObjectTemplate7,var_Object,var_Object1

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_NETObjectTemplate1 = var_NETObjectTemplate.Item("Nodes.Add(`Root 1`)")
		var_NETObjectTemplate = var_NETObjectTemplate1.Item("Nodes.Add(`Child 1`)")
		var_NETObjectTemplate2 = var_NETObjectTemplate1.Item("Nodes.Add(`Child 2`)")
			var_NETObjectTemplate1 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.1`)")
			var_NETObjectTemplate2 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.2`)")
			var_NETObjectTemplate3 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.3`)")
			var_Object = var_NETObjectTemplate2.Item("Expand()")
		var_NETObjectTemplate4 = var_NETObjectTemplate1.Item("Nodes.Add(`Child 3`)")
		var_Object1 = var_NETObjectTemplate1.Item("Expand()")
	var_NETObjectTemplate5 = var_NETObjectTemplate.Item("Nodes.Add(`Root 2`)")
		var_NETObjectTemplate5 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 1`)")
		var_NETObjectTemplate6 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 2`)")
		var_NETObjectTemplate7 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 3`)")

XBasic (Alpha Five)

Dim oNETHost as P
Dim var_NETObjectTemplate as P
Dim var_NETObjectTemplate1 as P
Dim var_NETObjectTemplate2 as P
Dim var_NETObjectTemplate3 as P
Dim var_NETObjectTemplate4 as P
Dim var_NETObjectTemplate5 as P
Dim var_NETObjectTemplate6 as P
Dim var_NETObjectTemplate7 as P
Dim var_Object as P
Dim var_Object1 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_NETObjectTemplate1 = var_NETObjectTemplate.Item("Nodes.Add(`Root 1`)")
		var_NETObjectTemplate = var_NETObjectTemplate1.Item("Nodes.Add(`Child 1`)")
		var_NETObjectTemplate2 = var_NETObjectTemplate1.Item("Nodes.Add(`Child 2`)")
			var_NETObjectTemplate1 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.1`)")
			var_NETObjectTemplate2 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.2`)")
			var_NETObjectTemplate3 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.3`)")
			var_Object = var_NETObjectTemplate2.Item("Expand()")
		var_NETObjectTemplate4 = var_NETObjectTemplate1.Item("Nodes.Add(`Child 3`)")
		var_Object1 = var_NETObjectTemplate1.Item("Expand()")
	var_NETObjectTemplate5 = var_NETObjectTemplate.Item("Nodes.Add(`Root 2`)")
		var_NETObjectTemplate5 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 1`)")
		var_NETObjectTemplate6 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 2`)")
		var_NETObjectTemplate7 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 3`)")

Visual Objects

local var_NETObjectTemplate as INETObjectTemplate
local var_NETObjectTemplate1,var_NETObjectTemplate2,var_NETObjectTemplate3,var_NETObjectTemplate4,var_NETObjectTemplate5,var_NETObjectTemplate6,var_NETObjectTemplate7 as INETObjectTemplate
local var_Object,var_Object1 as USUAL

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_NETObjectTemplate1 := var_NETObjectTemplate:[Item,"Nodes.Add(`Root 1`)"]
		var_NETObjectTemplate := var_NETObjectTemplate1:[Item,"Nodes.Add(`Child 1`)"]
		var_NETObjectTemplate2 := var_NETObjectTemplate1:[Item,"Nodes.Add(`Child 2`)"]
			var_NETObjectTemplate1 := var_NETObjectTemplate2:[Item,"Nodes.Add(`Sub-Child 2.1`)"]
			var_NETObjectTemplate2 := var_NETObjectTemplate2:[Item,"Nodes.Add(`Sub-Child 2.2`)"]
			var_NETObjectTemplate3 := var_NETObjectTemplate2:[Item,"Nodes.Add(`Sub-Child 2.3`)"]
			var_Object := var_NETObjectTemplate2:[Item,"Expand()"]
		var_NETObjectTemplate4 := var_NETObjectTemplate1:[Item,"Nodes.Add(`Child 3`)"]
		var_Object1 := var_NETObjectTemplate1:[Item,"Expand()"]
	var_NETObjectTemplate5 := var_NETObjectTemplate:[Item,"Nodes.Add(`Root 2`)"]
		var_NETObjectTemplate5 := var_NETObjectTemplate5:[Item,"Nodes.Add(`Child 1`)"]
		var_NETObjectTemplate6 := var_NETObjectTemplate5:[Item,"Nodes.Add(`Child 2`)"]
		var_NETObjectTemplate7 := var_NETObjectTemplate5:[Item,"Nodes.Add(`Child 3`)"]

PowerBuilder

OleObject oNETHost,var_NETObjectTemplate,var_NETObjectTemplate1,var_NETObjectTemplate2,var_NETObjectTemplate3,var_NETObjectTemplate4,var_NETObjectTemplate5,var_NETObjectTemplate6,var_NETObjectTemplate7,var_Object,var_Object1

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_NETObjectTemplate1 = var_NETObjectTemplate.Item("Nodes.Add(`Root 1`)")
		var_NETObjectTemplate = var_NETObjectTemplate1.Item("Nodes.Add(`Child 1`)")
		var_NETObjectTemplate2 = var_NETObjectTemplate1.Item("Nodes.Add(`Child 2`)")
			var_NETObjectTemplate1 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.1`)")
			var_NETObjectTemplate2 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.2`)")
			var_NETObjectTemplate3 = var_NETObjectTemplate2.Item("Nodes.Add(`Sub-Child 2.3`)")
			var_Object = var_NETObjectTemplate2.Item("Expand()")
		var_NETObjectTemplate4 = var_NETObjectTemplate1.Item("Nodes.Add(`Child 3`)")
		var_Object1 = var_NETObjectTemplate1.Item("Expand()")
	var_NETObjectTemplate5 = var_NETObjectTemplate.Item("Nodes.Add(`Root 2`)")
		var_NETObjectTemplate5 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 1`)")
		var_NETObjectTemplate6 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 2`)")
		var_NETObjectTemplate7 = var_NETObjectTemplate5.Item("Nodes.Add(`Child 3`)")

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
		Variant voNETObjectTemplate1
		Get ComItem of hoNETObjectTemplate "Nodes.Add(`Root 1`)" to voNETObjectTemplate1
		Handle hoNETObjectTemplate1
		Get Create (RefClass(cComNETObjectTemplate)) to hoNETObjectTemplate1
		Set pvComObject of hoNETObjectTemplate1 to voNETObjectTemplate1
			Variant var_NETObjectTemplate
			Get ComItem of hoNETObjectTemplate1 "Nodes.Add(`Child 1`)" to var_NETObjectTemplate
			Variant voNETObjectTemplate2
			Get ComItem of hoNETObjectTemplate1 "Nodes.Add(`Child 2`)" to voNETObjectTemplate2
			Handle hoNETObjectTemplate2
			Get Create (RefClass(cComNETObjectTemplate)) to hoNETObjectTemplate2
			Set pvComObject of hoNETObjectTemplate2 to voNETObjectTemplate2
				Variant var_NETObjectTemplate1
				Get ComItem of hoNETObjectTemplate2 "Nodes.Add(`Sub-Child 2.1`)" to var_NETObjectTemplate1
				Variant var_NETObjectTemplate2
				Get ComItem of hoNETObjectTemplate2 "Nodes.Add(`Sub-Child 2.2`)" to var_NETObjectTemplate2
				Variant var_NETObjectTemplate3
				Get ComItem of hoNETObjectTemplate2 "Nodes.Add(`Sub-Child 2.3`)" to var_NETObjectTemplate3
				Variant var_Object
				Get ComItem of hoNETObjectTemplate2 "Expand()" to var_Object
			Send Destroy to hoNETObjectTemplate2
			Variant var_NETObjectTemplate4
			Get ComItem of hoNETObjectTemplate1 "Nodes.Add(`Child 3`)" to var_NETObjectTemplate4
			Variant var_Object1
			Get ComItem of hoNETObjectTemplate1 "Expand()" to var_Object1
		Send Destroy to hoNETObjectTemplate1
		Variant voNETObjectTemplate3
		Get ComItem of hoNETObjectTemplate "Nodes.Add(`Root 2`)" to voNETObjectTemplate3
		Handle hoNETObjectTemplate3
		Get Create (RefClass(cComNETObjectTemplate)) to hoNETObjectTemplate3
		Set pvComObject of hoNETObjectTemplate3 to voNETObjectTemplate3
			Variant var_NETObjectTemplate5
			Get ComItem of hoNETObjectTemplate3 "Nodes.Add(`Child 1`)" to var_NETObjectTemplate5
			Variant var_NETObjectTemplate6
			Get ComItem of hoNETObjectTemplate3 "Nodes.Add(`Child 2`)" to var_NETObjectTemplate6
			Variant var_NETObjectTemplate7
			Get ComItem of hoNETObjectTemplate3 "Nodes.Add(`Child 3`)" to var_NETObjectTemplate7
		Send Destroy to hoNETObjectTemplate3
	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 oNETObjectTemplate1,oNETObjectTemplate2,oNETObjectTemplate3,var_NETObjectTemplate,var_NETObjectTemplate1,var_NETObjectTemplate2,var_NETObjectTemplate3,var_NETObjectTemplate4,var_NETObjectTemplate5,var_NETObjectTemplate6,var_NETObjectTemplate7
	LOCAL oNETHost
	LOCAL var_Object,var_Object1

	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()
			oNETObjectTemplate1 := oNETObjectTemplate:Item("Nodes.Add(`Root 1`)")
				var_NETObjectTemplate := oNETObjectTemplate1:Item("Nodes.Add(`Child 1`)")
				oNETObjectTemplate2 := oNETObjectTemplate1:Item("Nodes.Add(`Child 2`)")
					var_NETObjectTemplate1 := oNETObjectTemplate2:Item("Nodes.Add(`Sub-Child 2.1`)")
					var_NETObjectTemplate2 := oNETObjectTemplate2:Item("Nodes.Add(`Sub-Child 2.2`)")
					var_NETObjectTemplate3 := oNETObjectTemplate2:Item("Nodes.Add(`Sub-Child 2.3`)")
					var_Object := oNETObjectTemplate2:Item("Expand()")
				var_NETObjectTemplate4 := oNETObjectTemplate1:Item("Nodes.Add(`Child 3`)")
				var_Object1 := oNETObjectTemplate1:Item("Expand()")
			oNETObjectTemplate3 := oNETObjectTemplate:Item("Nodes.Add(`Root 2`)")
				var_NETObjectTemplate5 := oNETObjectTemplate3:Item("Nodes.Add(`Child 1`)")
				var_NETObjectTemplate6 := oNETObjectTemplate3:Item("Nodes.Add(`Child 2`)")
				var_NETObjectTemplate7 := oNETObjectTemplate3:Item("Nodes.Add(`Child 3`)")

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