property Item.SubControl as Control
Retrieves the Control object that holds information about item's inside component.

TypeDescription
Control A Control object that holds properties to handle the inside ActiveX item.

Use the SubControl property when using the ItemTypeEnum.SubControl to add an item that hosts an ActiveX inside. Use the ControlID property to specify the IDentifier of the object to be displayed on the item. Use the Create method to create an inside ActiveX control. The inside ActiveX control fires the events through the OleEvent event.

The following screen shot displays an item with an ExCalendar inside:

The following samples shows how to load an ActiveX control ( Exontrol.Calendar )

VBA (MS Access, Excell...)

With ToolBar1
	With .Items.Add("Calendar",3).SubControl
		.Width = 256
		.Height = 256
		.ControlID = "Exontrol.Calendar"
		.Create 
	End With
	.Refresh 
End With

VB6

With ToolBar1
	With .Items.Add("Calendar",3).SubControl
		.Width = 256
		.Height = 256
		.ControlID = "Exontrol.Calendar"
		.Create 
	End With
	.Refresh 
End With

VB.NET

With Extoolbar1
	With .Items.Add("Calendar",3).SubControl
		.Width = 256
		.Height = 256
		.ControlID = "Exontrol.Calendar"
		.Create()
	End With
	.Refresh()
End With

VB.NET for /COM

With AxToolBar1
	With .Items.Add("Calendar",3).SubControl
		.Width = 256
		.Height = 256
		.ControlID = "Exontrol.Calendar"
		.Create()
	End With
	.Refresh()
End With

C++

/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXTOOLBARLib' for the library: 'ExToolBar 1.0 Control Library'

	#import <ExToolBar.dll>
	using namespace EXTOOLBARLib;
*/
EXTOOLBARLib::IToolBarPtr spToolBar1 = GetDlgItem(IDC_TOOLBAR1)->GetControlUnknown();
EXTOOLBARLib::IControlPtr var_Control = spToolBar1->GetItems()->Add(L"Calendar",long(3),vtMissing)->GetSubControl();
	var_Control->PutWidth(256);
	var_Control->PutHeight(256);
	var_Control->PutControlID(L"Exontrol.Calendar");
	var_Control->Create();
spToolBar1->Refresh();

C++ Builder

Extoolbarlib_tlb::IControlPtr var_Control = ToolBar1->Items->Add(L"Calendar",TVariant(3),TNoParam())->SubControl;
	var_Control->Width = 256;
	var_Control->Height = 256;
	var_Control->ControlID = L"Exontrol.Calendar";
	var_Control->Create();
ToolBar1->Refresh();

C#

exontrol.EXTOOLBARLib.Control var_Control = extoolbar1.Items.Add("Calendar",3,null).SubControl;
	var_Control.Width = 256;
	var_Control.Height = 256;
	var_Control.ControlID = "Exontrol.Calendar";
	var_Control.Create();
extoolbar1.Refresh();

JScript/JavaScript

<BODY onload='Init()'>
<OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="ToolBar1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	var var_Control = ToolBar1.Items.Add("Calendar",3,null).SubControl;
		var_Control.Width = 256;
		var_Control.Height = 256;
		var_Control.ControlID = "Exontrol.Calendar";
		var_Control.Create();
	ToolBar1.Refresh();
}
</SCRIPT>
</BODY>

VBScript

<BODY onload='Init()'>
<OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="ToolBar1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With ToolBar1
		With .Items.Add("Calendar",3).SubControl
			.Width = 256
			.Height = 256
			.ControlID = "Exontrol.Calendar"
			.Create 
		End With
		.Refresh 
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

EXTOOLBARLib.Control var_Control = axToolBar1.Items.Add("Calendar",3,null).SubControl;
	var_Control.Width = 256;
	var_Control.Height = 256;
	var_Control.ControlID = "Exontrol.Calendar";
	var_Control.Create();
axToolBar1.Refresh();

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Control,com_Item;
	anytype var_Control,var_Item;
	;

	super();

	var_Item = COM::createFromObject(extoolbar1.Items()).Add("Calendar",COMVariant::createFromInt(3)); com_Item = var_Item;
	var_Control = com_Item.SubControl(); com_Control = var_Control;
		com_Control.Width(256);
		com_Control.Height(256);
		com_Control.ControlID("Exontrol.Calendar");
		com_Control.Create();
	extoolbar1.Refresh();
}

Delphi 8 (.NET only)

with AxToolBar1 do
begin
	with Items.Add('Calendar',TObject(3),Nil).SubControl do
	begin
		Width := 256;
		Height := 256;
		ControlID := 'Exontrol.Calendar';
		Create();
	end;
	Refresh();
end

Delphi (standard)

with ToolBar1 do
begin
	with Items.Add('Calendar',OleVariant(3),Null).SubControl do
	begin
		Width := 256;
		Height := 256;
		ControlID := 'Exontrol.Calendar';
		Create();
	end;
	Refresh();
end

VFP

with thisform.ToolBar1
	with .Items.Add("Calendar",3).SubControl
		.Width = 256
		.Height = 256
		.ControlID = "Exontrol.Calendar"
		.Create
	endwith
	.Refresh
endwith

dBASE Plus

local oToolBar,var_Control

oToolBar = form.Activex1.nativeObject
var_Control = oToolBar.Items.Add("Calendar",3).SubControl
	var_Control.Width = 256
	var_Control.Height = 256
	var_Control.ControlID = "Exontrol.Calendar"
	var_Control.Create()
oToolBar.Refresh()

XBasic (Alpha Five)

Dim oToolBar as P
Dim var_Control as P

oToolBar = topparent:CONTROL_ACTIVEX1.activex
var_Control = oToolBar.Items.Add("Calendar",3).SubControl
	var_Control.Width = 256
	var_Control.Height = 256
	var_Control.ControlID = "Exontrol.Calendar"
	var_Control.Create()
oToolBar.Refresh()

Visual Objects

local var_Control as IControl

var_Control := oDCOCX_Exontrol1:Items:Add("Calendar",3,nil):SubControl
	var_Control:Width := 256
	var_Control:Height := 256
	var_Control:ControlID := "Exontrol.Calendar"
	var_Control:Create()
oDCOCX_Exontrol1:Refresh()

PowerBuilder

OleObject oToolBar,var_Control

oToolBar = ole_1.Object
var_Control = oToolBar.Items.Add("Calendar",3).SubControl
	var_Control.Width = 256
	var_Control.Height = 256
	var_Control.ControlID = "Exontrol.Calendar"
	var_Control.Create()
oToolBar.Refresh()

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Variant voItems
	Get ComItems to voItems
	Handle hoItems
	Get Create (RefClass(cComItems)) to hoItems
	Set pvComObject of hoItems to voItems
		Variant voItem
		Get ComAdd of hoItems "Calendar" 3 Nothing to voItem
		Handle hoItem
		Get Create (RefClass(cComItem)) to hoItem
		Set pvComObject of hoItem to voItem
			Variant voControl
			Get ComSubControl of hoItem to voControl
			Handle hoControl
			Get Create (RefClass(cComControl)) to hoControl
			Set pvComObject of hoControl to voControl
				Set ComWidth of hoControl to 256
				Set ComHeight of hoControl to 256
				Set ComControlID of hoControl to "Exontrol.Calendar"
				Send ComCreate of hoControl
			Send Destroy to hoControl
		Send Destroy to hoItem
	Send Destroy to hoItems
	Send ComRefresh
End_Procedure

XBase++

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

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oControl
	LOCAL oToolBar

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

	oToolBar := XbpActiveXControl():new( oForm:drawingArea )
	oToolBar:CLSID  := "Exontrol.ToolBar.1" /*{DDF58CFA-750F-45E0-8A00-CFBE431702E2}*/
	oToolBar:create(,, {10,60},{610,370} )

		oControl := oToolBar:Items():Add("Calendar",3):SubControl()
			oControl:Width := 256
			oControl:Height := 256
			oControl:ControlID := "Exontrol.Calendar"
			oControl:Create()
		oToolBar:Refresh()

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