Type | Description | |||
Name as String | A String expression that specifies the name of the property to be added. | |||
Value as Variant | A VARIANT expression that specifies the value of the property to be added. |
Return | Description | |||
Property | A Property object being created. |
The following is a simple example of an iCalendar format:
BEGIN:VCALENDAR
Version:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
END:VCALENDAR
The Version, PRODID are properties of the VCALENDAR object .
The following sample shows how you can add new properties to the component:
VBA (MS Access, Excell...)
Set ICalendar1 = CreateObject("Exontrol.ICalendar.1") With ICalendar1 With .Content.Components.Add("VCALENDAR").Properties .Add "Version","2.0" .Add "PRODID","-//hacksw/handcal//NONSGML v1.0//EN" End With Debug.Print( .Save ) End With
VB6
Set ICalendar1 = CreateObject("Exontrol.ICalendar.1") With ICalendar1 With .Content.Components.Add("VCALENDAR").Properties .Add "Version","2.0" .Add "PRODID","-//hacksw/handcal//NONSGML v1.0//EN" 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("Version","2.0") .Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") 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("Version","2.0") .Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") 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::IPropertiesPtr var_Properties = spICalendar1->GetContent()->GetComponents()->Add(L"VCALENDAR")->GetProperties(); var_Properties->Add(L"Version","2.0"); var_Properties->Add(L"PRODID","-//hacksw/handcal//NONSGML v1.0//EN"); OutputDebugStringW( spICalendar1->Save() );
C++ Builder
Exicalendarlib_tlb::IICalendarPtr ICalendar1 = Variant::CreateObject(L"Exontrol.ICalendar.1"); Exicalendarlib_tlb::IPropertiesPtr var_Properties = ICalendar1->Content->Components->Add(L"VCALENDAR")->Properties; var_Properties->Add(L"Version",TVariant("2.0")); var_Properties->Add(L"PRODID",TVariant("-//hacksw/handcal//NONSGML v1.0//EN")); OutputDebugString( ICalendar1->Save() );
C#
// Add 'exontrol.exicalendar.dll(ExICalendar.dll)' reference to your project. exontrol.EXICALENDARLib.exicalendar exicalendar1 = new exontrol.EXICALENDARLib.exicalendar(); exontrol.EXICALENDARLib.Properties var_Properties = exicalendar1.Content.Components.Add("VCALENDAR").Properties; var_Properties.Add("Version","2.0"); var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN"); 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_Properties = ICalendar1.Content.Components.Add("VCALENDAR").Properties; var_Properties.Add("Version","2.0"); var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN"); 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 "Version","2.0" .Add "PRODID","-//hacksw/handcal//NONSGML v1.0//EN" End With alert( .Save ) End With End Function </SCRIPT> </BODY>
C# for /COM
EXICALENDARLib.ICalendar axICalendar1 = new EXICALENDARLib.ICalendar(); EXICALENDARLib.Properties var_Properties = axICalendar1.Content.Components.Add("VCALENDAR").Properties; var_Properties.Add("Version","2.0"); var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN"); System.Diagnostics.Debug.Print( axICalendar1.Save() );
X++ (Dynamics Ax 2009)
public void init() { COM com_Component,com_Properties,com_exicalendar1; anytype exicalendar1,var_Component,var_Properties; ; 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_Component.Properties(); com_Properties = var_Properties; com_Properties.Add("Version","2.0"); com_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN"); 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').Properties do begin Add('Version','2.0'); Add('PRODID','-//hacksw/handcal//NONSGML v1.0//EN'); 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').Properties do begin Add('Version','2.0'); Add('PRODID','-//hacksw/handcal//NONSGML v1.0//EN'); end; OutputDebugString( Save() ); end
VFP
thisform.ICalendar1 = CreateObject("Exontrol.ICalendar.1") with thisform.ICalendar1 with .Content.Components.Add("VCALENDAR").Properties .Add("Version","2.0") .Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") endwith DEBUGOUT( .Save ) endwith
dBASE Plus
local oICalendar,var_Properties oICalendar = new OleAutoClient("Exontrol.ICalendar.1") var_Properties = oICalendar.Content.Components.Add("VCALENDAR").Properties var_Properties.Add("Version","2.0") var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") ? oICalendar.Save()
XBasic (Alpha Five)
Dim oICalendar as P Dim var_Properties as P oICalendar = OLE.Create("Exontrol.ICalendar.1") var_Properties = oICalendar.Content.Components.Add("VCALENDAR").Properties var_Properties.Add("Version","2.0") var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") ? oICalendar.Save()
Visual Objects
local var_Properties as IProperties oDCOCX_Exontrol1 := IICalendar{"Exontrol.ICalendar.1"} var_Properties := oDCOCX_Exontrol1:Content:Components:Add("VCALENDAR"):Properties var_Properties:Add("Version","2.0") var_Properties:Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") OutputDebugString(String2Psz( oDCOCX_Exontrol1:Save() ))
PowerBuilder
OleObject oICalendar,var_Properties oICalendar = CREATE OLEObject oICalendar.ConnectToNewObject("Exontrol.ICalendar.1") var_Properties = oICalendar.Content.Components.Add("VCALENDAR").Properties var_Properties.Add("Version","2.0") var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") 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 Get ComAdd of hoProperties "Version" "2.0" to Nothing Get ComAdd of hoProperties "PRODID" "-//hacksw/handcal//NONSGML v1.0//EN" to Nothing Send Destroy to hoProperties 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 oProperties 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} ) oProperties := oICalendar:Content():Components():Add("VCALENDAR"):Properties() oProperties:Add("Version","2.0") oProperties:Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") DevOut( oICalendar:Save() ) oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN