property ICalendar.toICalendar (Value as Variant, Type as PropertyTypeEnum) as String
Converts the giving VARIANT expression to ICalendar format. For instance, toICalendar(CSng(15.5), exPropertyTypeDuration) returns "P15DT12H".

TypeDescription
Value as Variant A VARIANT expression to be converted to specified type
Type as PropertyTypeEnum A PropertyTypeEnum expression that specifies the type of value to be converted to.
String A String expression that specifies the iCalendar format of the value / type
The toICalendar property converts the giving value to a specified type. The valuesFromICalendar property extracts all values or specified value of the giving value/type in ICalendar format. The GuessType property guesses the property's type, from its value. The Value property specifies the value of the property. The Name property specifies the name of the property. The Parameters property specifies the property's Parameters collection. 

The following samples converts a string value to a exPropertyTypeBinary value:

VBA (MS Access, Excell...)

Set ICalendar1 = CreateObject("Exontrol.ICalendar.1")
With ICalendar1
	With .Content.Components.Add("VCALENDAR")
		.Properties.Add "Binary1",ICalendar1.toICalendar("This is a bit of text converted to binary",1)
		With .Properties.Add("Binary2")
			.Value = "This is a bit of text converted to binary"
			.Type = 1
		End With
	End With
	Debug.Print( .Save )
End With

VB6

Set ICalendar1 = CreateObject("Exontrol.ICalendar.1")
With ICalendar1
	With .Content.Components.Add("VCALENDAR")
		.Properties.Add "Binary1",ICalendar1.toICalendar("This is a bit of text converted to binary",exPropertyTypeBinary)
		With .Properties.Add("Binary2")
			.Value = "This is a bit of text converted to binary"
			.Type = exPropertyTypeBinary
		End With
	End With
	Debug.Print( .Save )
End With

VB.NET

' Add 'exontrol.exicalendar.dll(ExICalendar.dll)' reference to your project.
Exicalendar1 = New exontrol.EXICALENDARLib.exicalendar()
With Exicalendar1
	With .Content.Components.Add("VCALENDAR")
		.Properties.Add("Binary1",Exicalendar1.get_toICalendar("This is a bit of text converted to binary",exontrol.EXICALENDARLib.PropertyTypeEnum.exPropertyTypeBinary))
		With .Properties.Add("Binary2")
			.Value = "This is a bit of text converted to binary"
			.Type = exontrol.EXICALENDARLib.PropertyTypeEnum.exPropertyTypeBinary
		End With
	End With
	Debug.Print( .Save() )
End With

VB.NET for /COM

AxICalendar1 = CreateObject("Exontrol.ICalendar.1")
With AxICalendar1
	With .Content.Components.Add("VCALENDAR")
		.Properties.Add("Binary1",AxICalendar1.toICalendar("This is a bit of text converted to binary",EXICALENDARLib.PropertyTypeEnum.exPropertyTypeBinary))
		With .Properties.Add("Binary2")
			.Value = "This is a bit of text converted to binary"
			.Type = EXICALENDARLib.PropertyTypeEnum.exPropertyTypeBinary
		End With
	End With
	Debug.Print( .Save() )
End With

C++

/*
	Includes the definition for CreateObject function like follows:

	#include <comdef.h>
	IUnknownPtr CreateObject( BSTR Object )
	{
		IUnknownPtr spResult;
		spResult.CreateInstance( Object );
		return spResult;
	};

*/
/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXICALENDARLib' for the library: 'ICalendar 1.0 Type Library'

	#import <ExICalendar.dll>
	using namespace EXICALENDARLib;
*/
EXICALENDARLib::IICalendarPtr spICalendar1 = ::CreateObject(L"Exontrol.ICalendar.1");
EXICALENDARLib::IComponentPtr var_Component = spICalendar1->GetContent()->GetComponents()->Add(L"VCALENDAR");
	var_Component->GetProperties()->Add(L"Binary1",spICalendar1->GettoICalendar("This is a bit of text converted to binary",EXICALENDARLib::exPropertyTypeBinary));
	EXICALENDARLib::IPropertyPtr var_Property = var_Component->GetProperties()->Add(L"Binary2",vtMissing);
		var_Property->PutValue("This is a bit of text converted to binary");
		var_Property->PutType(EXICALENDARLib::exPropertyTypeBinary);
OutputDebugStringW( spICalendar1->Save() );

C++ Builder

Exicalendarlib_tlb::IICalendarPtr ICalendar1 = Variant::CreateObject(L"Exontrol.ICalendar.1");
Exicalendarlib_tlb::IComponentPtr var_Component = ICalendar1->Content->Components->Add(L"VCALENDAR");
	var_Component->Properties->Add(L"Binary1",TVariant(ICalendar1->get_toICalendar(TVariant("This is a bit of text converted to binary"),Exicalendarlib_tlb::PropertyTypeEnum::exPropertyTypeBinary)));
	Exicalendarlib_tlb::IPropertyPtr var_Property = var_Component->Properties->Add(L"Binary2",TNoParam());
		var_Property->set_Value(TVariant("This is a bit of text converted to binary"));
		var_Property->Type = Exicalendarlib_tlb::PropertyTypeEnum::exPropertyTypeBinary;
OutputDebugString( ICalendar1->Save() );

C#

// Add 'exontrol.exicalendar.dll(ExICalendar.dll)' reference to your project.
exontrol.EXICALENDARLib.exicalendar exicalendar1 = new exontrol.EXICALENDARLib.exicalendar();
exontrol.EXICALENDARLib.Component var_Component = exicalendar1.Content.Components.Add("VCALENDAR");
	var_Component.Properties.Add("Binary1",exicalendar1.get_toICalendar("This is a bit of text converted to binary",exontrol.EXICALENDARLib.PropertyTypeEnum.exPropertyTypeBinary));
	exontrol.EXICALENDARLib.Property var_Property = var_Component.Properties.Add("Binary2",null);
		var_Property.Value = "This is a bit of text converted to binary";
		var_Property.Type = exontrol.EXICALENDARLib.PropertyTypeEnum.exPropertyTypeBinary;
System.Diagnostics.Debug.Print( exicalendar1.Save() );

JScript/JavaScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6" id="ICalendar1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	var var_Component = ICalendar1.Content.Components.Add("VCALENDAR");
		var_Component.Properties.Add("Binary1",ICalendar1.toICalendar("This is a bit of text converted to binary",1));
		var var_Property = var_Component.Properties.Add("Binary2",null);
			var_Property.Value = "This is a bit of text converted to binary";
			var_Property.Type = 1;
	alert( ICalendar1.Save() );
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6" id="ICalendar1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With ICalendar1
		With .Content.Components.Add("VCALENDAR")
			.Properties.Add "Binary1",ICalendar1.toICalendar("This is a bit of text converted to binary",1)
			With .Properties.Add("Binary2")
				.Value = "This is a bit of text converted to binary"
				.Type = 1
			End With
		End With
		alert( .Save )
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

EXICALENDARLib.ICalendar axICalendar1 = new EXICALENDARLib.ICalendar();
EXICALENDARLib.Component var_Component = axICalendar1.Content.Components.Add("VCALENDAR");
	var_Component.Properties.Add("Binary1",axICalendar1.get_toICalendar("This is a bit of text converted to binary",EXICALENDARLib.PropertyTypeEnum.exPropertyTypeBinary));
	EXICALENDARLib.Property var_Property = var_Component.Properties.Add("Binary2",null);
		var_Property.Value = "This is a bit of text converted to binary";
		var_Property.Type = EXICALENDARLib.PropertyTypeEnum.exPropertyTypeBinary;
System.Diagnostics.Debug.Print( axICalendar1.Save() );

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Component,com_Properties,com_Property,com_exicalendar1;
	anytype exicalendar1,var_Component,var_Properties,var_Property;
	;

	super();

	// Add 'exicalendar.dll(ExICalendar.dll)' reference to your project.
	exicalendar1 = COM::createFromObject(new EXICALENDARLib.exicalendar()); com_exicalendar1 = exicalendar1;
	var_Component = COM::createFromObject(com_exicalendar1.Content().Components()).Add("VCALENDAR"); com_Component = var_Component;
		var_Properties = COM::createFromObject(com_Component.Properties()); com_Properties = var_Properties;
		com_Properties.Add("Binary1",COMVariant::createFromStr(com_exicalendar1.toICalendar("This is a bit of text converted to binary",1/*exPropertyTypeBinary*/)));
		var_Properties = COM::createFromObject(com_Component.Properties()); com_Properties = var_Properties;
		var_Property = COM::createFromObject(com_Properties).Add("Binary2"); com_Property = var_Property;
			com_Property.Value("This is a bit of text converted to binary");
			com_Property.Type(1/*exPropertyTypeBinary*/);
	print( com_exicalendar1.Save() );
}

Delphi 8 (.NET only)

AxICalendar1 := (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.ICalendar.1')) as EXICALENDARLib.ICalendar);
with AxICalendar1 do
begin
	with Content.Components.Add('VCALENDAR') do
	begin
		Properties.Add('Binary1',TObject(AxICalendar1.toICalendar['This is a bit of text converted to binary',EXICALENDARLib.PropertyTypeEnum.exPropertyTypeBinary]));
		with Properties.Add('Binary2',Nil) do
		begin
			Value := 'This is a bit of text converted to binary';
			Type := EXICALENDARLib.PropertyTypeEnum.exPropertyTypeBinary;
		end;
	end;
	OutputDebugString( Save() );
end

Delphi (standard)

ICalendar1 := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.ICalendar.1'))) as EXICALENDARLib_TLB.ICalendar);
with ICalendar1 do
begin
	with Content.Components.Add('VCALENDAR') do
	begin
		Properties.Add('Binary1',OleVariant(ICalendar1.toICalendar['This is a bit of text converted to binary',EXICALENDARLib_TLB.exPropertyTypeBinary]));
		with Properties.Add('Binary2',Null) do
		begin
			Value := 'This is a bit of text converted to binary';
			Type := EXICALENDARLib_TLB.exPropertyTypeBinary;
		end;
	end;
	OutputDebugString( Save() );
end

VFP

thisform.ICalendar1 = CreateObject("Exontrol.ICalendar.1")
with thisform.ICalendar1
	with .Content.Components.Add("VCALENDAR")
		.Properties.Add("Binary1",thisform.ICalendar1.toICalendar("This is a bit of text converted to binary",1))
		with .Properties.Add("Binary2")
			.Value = "This is a bit of text converted to binary"
			.Type = 1
		endwith
	endwith
	DEBUGOUT( .Save )
endwith

dBASE Plus

local oICalendar,var_Component,var_Property

oICalendar = new OleAutoClient("Exontrol.ICalendar.1")

var_Component = oICalendar.Content.Components.Add("VCALENDAR")
	var_Component.Properties.Add("Binary1",oICalendar.toICalendar("This is a bit of text converted to binary",1))
	var_Property = var_Component.Properties.Add("Binary2")
		var_Property.Value = "This is a bit of text converted to binary"
		var_Property.Type = 1
? oICalendar.Save() 

XBasic (Alpha Five)

Dim oICalendar as P
Dim var_Component as P
Dim var_Property as P

oICalendar = OLE.Create("Exontrol.ICalendar.1")

var_Component = oICalendar.Content.Components.Add("VCALENDAR")
	var_Component.Properties.Add("Binary1",oICalendar.toICalendar("This is a bit of text converted to binary",1))
	var_Property = var_Component.Properties.Add("Binary2")
		var_Property.Value = "This is a bit of text converted to binary"
		var_Property.Type = 1
? oICalendar.Save() 

Visual Objects

local var_Component as IComponent
local var_Property as IProperty

oDCOCX_Exontrol1 := IICalendar{"Exontrol.ICalendar.1"}
var_Component := oDCOCX_Exontrol1:Content:Components:Add("VCALENDAR")
	var_Component:Properties:Add("Binary1",oDCOCX_Exontrol1:[toICalendar,"This is a bit of text converted to binary",exPropertyTypeBinary])
	var_Property := var_Component:Properties:Add("Binary2",nil)
		var_Property:Value := "This is a bit of text converted to binary"
		var_Property:Type := exPropertyTypeBinary
OutputDebugString(String2Psz( oDCOCX_Exontrol1:Save() ))

PowerBuilder

OleObject oICalendar,var_Component,var_Property

oICalendar = CREATE OLEObject
oICalendar.ConnectToNewObject("Exontrol.ICalendar.1")

var_Component = oICalendar.Content.Components.Add("VCALENDAR")
	var_Component.Properties.Add("Binary1",oICalendar.toICalendar("This is a bit of text converted to binary",1))
	var_Property = var_Component.Properties.Add("Binary2")
		var_Property.Value = "This is a bit of text converted to binary"
		var_Property.Type = 1
MessageBox("Information",string( oICalendar.Save() ))

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Variant oComICalendar1
	Get ComCreateObject "Exontrol.ICalendar.1" to oComICalendar1

	Variant voComponent
	Get ComContent to voComponent
	Handle hoComponent
	Get Create (RefClass(cComComponent)) to hoComponent
	Set pvComObject of hoComponent to voComponent
		Variant voComponents
		Get ComComponents of hoComponent to voComponents
		Handle hoComponents
		Get Create (RefClass(cComComponents)) to hoComponents
		Set pvComObject of hoComponents to voComponents
			Variant voComponent1
			Get ComAdd of hoComponents "VCALENDAR" to voComponent1
			Handle hoComponent1
			Get Create (RefClass(cComComponent)) to hoComponent1
			Set pvComObject of hoComponent1 to voComponent1
				Variant voProperties
				Get ComProperties of hoComponent1 to voProperties
				Handle hoProperties
				Get Create (RefClass(cComProperties)) to hoProperties
				Set pvComObject of hoProperties to voProperties
					Variant vValue
						Get ComtoICalendar "This is a bit of text converted to binary" OLEexPropertyTypeBinary to vValue
					Get ComAdd of hoProperties "Binary1" vValue to Nothing
				Send Destroy to hoProperties
				Variant voProperties1
				Get ComProperties of hoComponent1 to voProperties1
				Handle hoProperties1
				Get Create (RefClass(cComProperties)) to hoProperties1
				Set pvComObject of hoProperties1 to voProperties1
					Variant voProperty
					Get ComAdd of hoProperties1 "Binary2" Nothing to voProperty
					Handle hoProperty
					Get Create (RefClass(cComProperty)) to hoProperty
					Set pvComObject of hoProperty to voProperty
						Set ComValue of hoProperty to "This is a bit of text converted to binary"
						Set ComType of hoProperty to OLEexPropertyTypeBinary
					Send Destroy to hoProperty
				Send Destroy to hoProperties1
			Send Destroy to hoComponent1
		Send Destroy to hoComponents
	Send Destroy to hoComponent
	Showln (ComSave(Self))
End_Procedure

XBase++

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

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oICalendar
	LOCAL oComponent
	LOCAL oProperty

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

	oICalendar := XbpActiveXControl():new( oForm:drawingArea )
	oICalendar:CLSID  := "Exontrol.ICalendar.1" /*{D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6}*/
	oICalendar:create(,, {10,60},{610,370} )

		oComponent := oICalendar:Content():Components():Add("VCALENDAR")
			oComponent:Properties():Add("Binary1",oICalendar:toICalendar("This is a bit of text converted to binary",1/*exPropertyTypeBinary*/))
			oProperty := oComponent:Properties():Add("Binary2")
				oProperty:Value := "This is a bit of text converted to binary"
				oProperty:Type := 1/*exPropertyTypeBinary*/
		DevOut( oICalendar:Save() )

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