property Chart.ShowEmptyBars as Long
Specifies whether empty bars are shown or hidden.

TypeDescription
Long A long expression that specifies the number of time units being added to the end of each bar.  An empty bar has the start and end dates identical.
By default, the ShowEmptyBars property is 0. Use the ShowEmptyBars to show the bars, even if the Start and End date are identical. In other words, if this property is 1, the bars will be shown from the start date to end date plus 1 tim-unit, where the time unit is indicated by the ShowEmptyBarsUnit property. For instance, if the ShowEmptyBars property is 1, a task bar from 1/1/2001 to 1/2/2001 shows two days, else if the ShowEmptyBars property is 0, the same task bar highlights only a single day. 

Use the AddBar method to assign a bar to an item. Use the ItemBar(exBarStart) and ItemBar(exBarEnd)/ItemBar(exBarEndInclusive)  properties to specify the start and end dates for a bar.

!We do not recommend using the ShowEmptyBars property on a non-zero value, if the chart displays bars with ItemBar(exBarKeepWorkingCount) property on False ( default ). If your chart displays bars with ItemBar(exBarKeepWorkingCount) property  on True, you can use the ItemBar(exBarEndInclusive) to display the end date to be last visible date of the bar. In this case, for instance, a a task bar from 1/1/2001 to 1/3/2001 shows two days, the exBarEnd displays 1/3/2001, while the exBarEndInclusive displays 1/2/2001.

The following samples show how to add bars with the same starting and ending point. This is recommended for bars with NO exBarKeepWorkingCount. Here you will find the samples for bars with exBarKeepWorkingCount property set.

VBA (MS Access, Excell...)

With G2antt1
	.BeginUpdate 
	.MarkSearchColumn = False
	With .Columns
		.Add "Tasks"
		.Add("Start").Def(18) = 1
		.Add("End").Def(18) = 543
	End With
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.LevelCount = 2
		.PaneWidth(0) = 256
		.ShowEmptyBars = 1
	End With
	With .Items
		.AllowCellValueToItemBar = True
		h = .AddItem("Task 1")
		.AddBar h,"Task",#9/21/2006#,#9/21/2006#
	End With
	.EndUpdate 
End With

VB6

With G2antt1
	.BeginUpdate 
	.MarkSearchColumn = False
	With .Columns
		.Add "Tasks"
		.Add("Start").Def(exCellValueToItemBarProperty) = 1
		.Add("End").Def(exCellValueToItemBarProperty) = 543
	End With
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.LevelCount = 2
		.PaneWidth(0) = 256
		.ShowEmptyBars = 1
	End With
	With .Items
		.AllowCellValueToItemBar = True
		h = .AddItem("Task 1")
		.AddBar h,"Task",#9/21/2006#,#9/21/2006#
	End With
	.EndUpdate 
End With

VB.NET

Dim h
With Exg2antt1
	.BeginUpdate()
	.MarkSearchColumn = False
	With .Columns
		.Add("Tasks")
		.Add("Start").set_Def(exontrol.EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,1)
		.Add("End").set_Def(exontrol.EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,543)
	End With
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.LevelCount = 2
		.set_PaneWidth(False,256)
		.ShowEmptyBars = 1
	End With
	With .Items
		.AllowCellValueToItemBar = True
		h = .AddItem("Task 1")
		.AddBar(h,"Task",#9/21/2006#,#9/21/2006#)
	End With
	.EndUpdate()
End With

VB.NET for /COM

Dim h
With AxG2antt1
	.BeginUpdate()
	.MarkSearchColumn = False
	With .Columns
		.Add("Tasks")
		.Add("Start").Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty) = 1
		.Add("End").Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty) = 543
	End With
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.LevelCount = 2
		.PaneWidth(False) = 256
		.ShowEmptyBars = 1
	End With
	With .Items
		.AllowCellValueToItemBar = True
		h = .AddItem("Task 1")
		.AddBar(h,"Task",#9/21/2006#,#9/21/2006#)
	End With
	.EndUpdate()
End With

C++

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

	#import <ExG2antt.dll>
	using namespace EXG2ANTTLib;
*/
EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown();
spG2antt1->BeginUpdate();
spG2antt1->PutMarkSearchColumn(VARIANT_FALSE);
EXG2ANTTLib::IColumnsPtr var_Columns = spG2antt1->GetColumns();
	var_Columns->Add(L"Tasks");
	((EXG2ANTTLib::IColumnPtr)(var_Columns->Add(L"Start")))->PutDef(EXG2ANTTLib::exCellValueToItemBarProperty,long(1));
	((EXG2ANTTLib::IColumnPtr)(var_Columns->Add(L"End")))->PutDef(EXG2ANTTLib::exCellValueToItemBarProperty,long(543));
EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart();
	var_Chart->PutFirstVisibleDate("9/20/2006");
	var_Chart->PutLevelCount(2);
	var_Chart->PutPaneWidth(VARIANT_FALSE,256);
	var_Chart->PutShowEmptyBars(1);
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
	var_Items->PutAllowCellValueToItemBar(VARIANT_TRUE);
	long h = var_Items->AddItem("Task 1");
	var_Items->AddBar(h,"Task","9/21/2006","9/21/2006",vtMissing,vtMissing);
spG2antt1->EndUpdate();

C++ Builder

G2antt1->BeginUpdate();
G2antt1->MarkSearchColumn = false;
Exg2anttlib_tlb::IColumnsPtr var_Columns = G2antt1->Columns;
	var_Columns->Add(L"Tasks");
	var_Columns->Add(L"Start")->set_Def(Exg2anttlib_tlb::DefColumnEnum::exCellValueToItemBarProperty,TVariant(1));
	var_Columns->Add(L"End")->set_Def(Exg2anttlib_tlb::DefColumnEnum::exCellValueToItemBarProperty,TVariant(543));
Exg2anttlib_tlb::IChartPtr var_Chart = G2antt1->Chart;
	var_Chart->set_FirstVisibleDate(TVariant(TDateTime(2006,9,20).operator double()));
	var_Chart->LevelCount = 2;
	var_Chart->set_PaneWidth(false,256);
	var_Chart->ShowEmptyBars = 1;
Exg2anttlib_tlb::IItemsPtr var_Items = G2antt1->Items;
	var_Items->AllowCellValueToItemBar = true;
	long h = var_Items->AddItem(TVariant("Task 1"));
	var_Items->AddBar(h,TVariant("Task"),TVariant(TDateTime(2006,9,21).operator double()),TVariant(TDateTime(2006,9,21).operator double()),TNoParam(),TNoParam());
G2antt1->EndUpdate();

C#

exg2antt1.BeginUpdate();
exg2antt1.MarkSearchColumn = false;
exontrol.EXG2ANTTLib.Columns var_Columns = exg2antt1.Columns;
	var_Columns.Add("Tasks");
	(var_Columns.Add("Start") as exontrol.EXG2ANTTLib.Column).set_Def(exontrol.EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,1);
	(var_Columns.Add("End") as exontrol.EXG2ANTTLib.Column).set_Def(exontrol.EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,543);
exontrol.EXG2ANTTLib.Chart var_Chart = exg2antt1.Chart;
	var_Chart.FirstVisibleDate = Convert.ToDateTime("9/20/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US"));
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(false,256);
	var_Chart.ShowEmptyBars = 1;
exontrol.EXG2ANTTLib.Items var_Items = exg2antt1.Items;
	var_Items.AllowCellValueToItemBar = true;
	int h = var_Items.AddItem("Task 1");
	var_Items.AddBar(h,"Task",Convert.ToDateTime("9/21/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("9/21/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US")),null,null);
exg2antt1.EndUpdate();

JavaScript

<OBJECT classid="clsid:CD481F4D-2D25-4759-803F-752C568F53B7" id="G2antt1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	G2antt1.BeginUpdate();
	G2antt1.MarkSearchColumn = false;
	var var_Columns = G2antt1.Columns;
		var_Columns.Add("Tasks");
		var_Columns.Add("Start").Def(18) = 1;
		var_Columns.Add("End").Def(18) = 543;
	var var_Chart = G2antt1.Chart;
		var_Chart.FirstVisibleDate = "9/20/2006";
		var_Chart.LevelCount = 2;
		var_Chart.PaneWidth(0) = 256;
		var_Chart.ShowEmptyBars = 1;
	var var_Items = G2antt1.Items;
		var_Items.AllowCellValueToItemBar = true;
		var h = var_Items.AddItem("Task 1");
		var_Items.AddBar(h,"Task","9/21/2006","9/21/2006",null,null);
	G2antt1.EndUpdate();
</SCRIPT>

C# for /COM

axG2antt1.BeginUpdate();
axG2antt1.MarkSearchColumn = false;
EXG2ANTTLib.Columns var_Columns = axG2antt1.Columns;
	var_Columns.Add("Tasks");
	(var_Columns.Add("Start") as EXG2ANTTLib.Column).set_Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,1);
	(var_Columns.Add("End") as EXG2ANTTLib.Column).set_Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,543);
EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart;
	var_Chart.FirstVisibleDate = Convert.ToDateTime("9/20/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US"));
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(false,256);
	var_Chart.ShowEmptyBars = 1;
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
	var_Items.AllowCellValueToItemBar = true;
	int h = var_Items.AddItem("Task 1");
	var_Items.AddBar(h,"Task",Convert.ToDateTime("9/21/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("9/21/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US")),null,null);
axG2antt1.EndUpdate();

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Chart,com_Columns,com_Items;
	anytype var_Chart,var_Columns,var_Items;
	int h;
	;

	super();

	exg2antt1.BeginUpdate();
	exg2antt1.MarkSearchColumn(false);
	var_Columns = exg2antt1.Columns(); com_Columns = var_Columns;
		com_Columns.Add("Tasks");
		COM::createFromVariant(com_Columns.Add("Start")).Def(18/*exCellValueToItemBarProperty*/,COMVariant::createFromInt(1));
		COM::createFromVariant(com_Columns.Add("End")).Def(18/*exCellValueToItemBarProperty*/,COMVariant::createFromInt(543));
	var_Chart = exg2antt1.Chart(); com_Chart = var_Chart;
		com_Chart.FirstVisibleDate(COMVariant::createFromDate(str2Date("9/20/2006",213)));
		com_Chart.LevelCount(2);
	/*should be called during the form's activate method*/ 	com_Chart.PaneWidth(0,256);
		com_Chart.ShowEmptyBars(1);
	var_Items = exg2antt1.Items(); com_Items = var_Items;
		com_Items.AllowCellValueToItemBar(true);
		h = com_Items.AddItem("Task 1");
		com_Items.AddBar(h,"Task",COMVariant::createFromDate(str2Date("9/21/2006",213)),COMVariant::createFromDate(str2Date("9/21/2006",213)));
	exg2antt1.EndUpdate();
}

/*
public void activate(boolean _active)
{
	;

	super(_active);

	exg2antt1.Chart().PaneWidth(0,256);
}
*/

Delphi 8 (.NET only)

with AxG2antt1 do
begin
	BeginUpdate();
	MarkSearchColumn := False;
	with Columns do
	begin
		Add('Tasks');
		(Add('Start') as EXG2ANTTLib.Column).Def[EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty] := TObject(1);
		(Add('End') as EXG2ANTTLib.Column).Def[EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty] := TObject(543);
	end;
	with Chart do
	begin
		FirstVisibleDate := '9/20/2006';
		LevelCount := 2;
		PaneWidth[False] := 256;
		ShowEmptyBars := 1;
	end;
	with Items do
	begin
		AllowCellValueToItemBar := True;
		h := AddItem('Task 1');
		AddBar(h,'Task','9/21/2006','9/21/2006',Nil,Nil);
	end;
	EndUpdate();
end

Delphi (standard)

with G2antt1 do
begin
	BeginUpdate();
	MarkSearchColumn := False;
	with Columns do
	begin
		Add('Tasks');
		(IUnknown(Add('Start')) as EXG2ANTTLib_TLB.Column).Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(1);
		(IUnknown(Add('End')) as EXG2ANTTLib_TLB.Column).Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(543);
	end;
	with Chart do
	begin
		FirstVisibleDate := '9/20/2006';
		LevelCount := 2;
		PaneWidth[False] := 256;
		ShowEmptyBars := 1;
	end;
	with Items do
	begin
		AllowCellValueToItemBar := True;
		h := AddItem('Task 1');
		AddBar(h,'Task','9/21/2006','9/21/2006',Null,Null);
	end;
	EndUpdate();
end

VFP

with thisform.G2antt1
	.BeginUpdate
	.MarkSearchColumn = .F.
	with .Columns
		.Add("Tasks")
		.Add("Start").Def(18) = 1
		.Add("End").Def(18) = 543
	endwith
	with .Chart
		.FirstVisibleDate = {^2006-9-20}
		.LevelCount = 2
		.PaneWidth(0) = 256
		.ShowEmptyBars = 1
	endwith
	with .Items
		.AllowCellValueToItemBar = .T.
		h = .AddItem("Task 1")
		.AddBar(h,"Task",{^2006-9-21},{^2006-9-21})
	endwith
	.EndUpdate
endwith

dBASE Plus

local h,oG2antt,var_Chart,var_Column,var_Column1,var_Columns,var_Items

oG2antt = form.Activex1.nativeObject
oG2antt.BeginUpdate()
oG2antt.MarkSearchColumn = false
var_Columns = oG2antt.Columns
	var_Columns.Add("Tasks")
	// var_Columns.Add("Start").Def(18) = 1
	var_Column = var_Columns.Add("Start")
	with (oG2antt)
		TemplateDef = [Dim var_Column]
		TemplateDef = var_Column
		Template = [var_Column.Def(18) = 1]
	endwith
	// var_Columns.Add("End").Def(18) = 543
	var_Column1 = var_Columns.Add("End")
	with (oG2antt)
		TemplateDef = [Dim var_Column1]
		TemplateDef = var_Column1
		Template = [var_Column1.Def(18) = 543]
	endwith
var_Chart = oG2antt.Chart
	var_Chart.FirstVisibleDate = "09/20/2006"
	var_Chart.LevelCount = 2
	// var_Chart.PaneWidth(false) = 256
	with (oG2antt)
		TemplateDef = [Dim var_Chart]
		TemplateDef = var_Chart
		Template = [var_Chart.PaneWidth(false) = 256]
	endwith
	var_Chart.ShowEmptyBars = 1
var_Items = oG2antt.Items
	var_Items.AllowCellValueToItemBar = true
	h = var_Items.AddItem("Task 1")
	var_Items.AddBar(h,"Task","09/21/2006","09/21/2006")
oG2antt.EndUpdate()

XBasic (Alpha Five)

Dim h as N
Dim oG2antt as P
Dim var_Chart as P
Dim var_Column as P
Dim var_Column1 as P
Dim var_Columns as P
Dim var_Items as P

oG2antt = topparent:CONTROL_ACTIVEX1.activex
oG2antt.BeginUpdate()
oG2antt.MarkSearchColumn = .f.
var_Columns = oG2antt.Columns
	var_Columns.Add("Tasks")
	' var_Columns.Add("Start").Def(18) = 1
	var_Column = var_Columns.Add("Start")
	oG2antt.TemplateDef = "Dim var_Column"
	oG2antt.TemplateDef = var_Column
	oG2antt.Template = "var_Column.Def(18) = 1"

	' var_Columns.Add("End").Def(18) = 543
	var_Column1 = var_Columns.Add("End")
	oG2antt.TemplateDef = "Dim var_Column1"
	oG2antt.TemplateDef = var_Column1
	oG2antt.Template = "var_Column1.Def(18) = 543"

var_Chart = oG2antt.Chart
	var_Chart.FirstVisibleDate = {09/20/2006}
	var_Chart.LevelCount = 2
	' var_Chart.PaneWidth(.f.) = 256
	oG2antt.TemplateDef = "Dim var_Chart"
	oG2antt.TemplateDef = var_Chart
	oG2antt.Template = "var_Chart.PaneWidth(False) = 256"

	var_Chart.ShowEmptyBars = 1
var_Items = oG2antt.Items
	var_Items.AllowCellValueToItemBar = .t.
	h = var_Items.AddItem("Task 1")
	var_Items.AddBar(h,"Task",{09/21/2006},{09/21/2006})
oG2antt.EndUpdate()

Visual Objects

local var_Chart as IChart
local var_Columns as IColumns
local var_Items as IItems
local h as USUAL

oDCOCX_Exontrol1:BeginUpdate()
oDCOCX_Exontrol1:MarkSearchColumn := false
var_Columns := oDCOCX_Exontrol1:Columns
	var_Columns:Add("Tasks")
	IColumn{var_Columns:Add("Start")}:[Def,exCellValueToItemBarProperty] := 1
	IColumn{var_Columns:Add("End")}:[Def,exCellValueToItemBarProperty] := 543
var_Chart := oDCOCX_Exontrol1:Chart
	var_Chart:FirstVisibleDate := SToD("20060920")
	var_Chart:LevelCount := 2
	var_Chart:[PaneWidth,false] := 256
	var_Chart:ShowEmptyBars := 1
var_Items := oDCOCX_Exontrol1:Items
	var_Items:AllowCellValueToItemBar := true
	h := var_Items:AddItem("Task 1")
	var_Items:AddBar(h,"Task",SToD("20060921"),SToD("20060921"),nil,nil)
oDCOCX_Exontrol1:EndUpdate()

PowerBuilder

OleObject oG2antt,var_Chart,var_Columns,var_Items
any h

oG2antt = ole_1.Object
oG2antt.BeginUpdate()
oG2antt.MarkSearchColumn = false
var_Columns = oG2antt.Columns
	var_Columns.Add("Tasks")
	var_Columns.Add("Start").Def(18,1)
	var_Columns.Add("End").Def(18,543)
var_Chart = oG2antt.Chart
	var_Chart.FirstVisibleDate = 2006-09-20
	var_Chart.LevelCount = 2
	var_Chart.PaneWidth(false,256)
	var_Chart.ShowEmptyBars = 1
var_Items = oG2antt.Items
	var_Items.AllowCellValueToItemBar = true
	h = var_Items.AddItem("Task 1")
	var_Items.AddBar(h,"Task",2006-09-21,2006-09-21)
oG2antt.EndUpdate()

The following samples show how to add bars with the same starting and ending point. This is recommended for bars with exBarKeepWorkingCount property set.

VBA (MS Access, Excell...)

With G2antt1
	.BeginUpdate 
	.MarkSearchColumn = False
	With .Columns
		.Add "Tasks"
		.Add("Start").Def(18) = 1
		.Add("End").Def(18) = 543
	End With
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.LevelCount = 2
		.PaneWidth(0) = 256
		.ShowEmptyBars = 0
	End With
	With .Items
		.AllowCellValueToItemBar = True
		h = .AddItem("Task 1")
		.AddBar h,"Task",#9/21/2006#,#9/21/2006#
		.ItemBar(h,"",543) = .ItemBar(h,"",1)
		.ItemBar(h,"",20) = True
	End With
	.EndUpdate 
End With

VB6

With G2antt1
	.BeginUpdate 
	.MarkSearchColumn = False
	With .Columns
		.Add "Tasks"
		.Add("Start").Def(exCellValueToItemBarProperty) = 1
		.Add("End").Def(exCellValueToItemBarProperty) = 543
	End With
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.LevelCount = 2
		.PaneWidth(0) = 256
		.ShowEmptyBars = 0
	End With
	With .Items
		.AllowCellValueToItemBar = True
		h = .AddItem("Task 1")
		.AddBar h,"Task",#9/21/2006#,#9/21/2006#
		.ItemBar(h,"",exBarEndInclusive) = .ItemBar(h,"",exBarStart)
		.ItemBar(h,"",exBarKeepWorkingCount) = True
	End With
	.EndUpdate 
End With

VB.NET

Dim h
With Exg2antt1
	.BeginUpdate()
	.MarkSearchColumn = False
	With .Columns
		.Add("Tasks")
		.Add("Start").set_Def(exontrol.EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,1)
		.Add("End").set_Def(exontrol.EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,543)
	End With
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.LevelCount = 2
		.set_PaneWidth(False,256)
		.ShowEmptyBars = 0
	End With
	With .Items
		.AllowCellValueToItemBar = True
		h = .AddItem("Task 1")
		.AddBar(h,"Task",#9/21/2006#,#9/21/2006#)
		.set_ItemBar(h,"",exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarEndInclusive,.get_ItemBar(h,"",exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarStart))
		.set_ItemBar(h,"",exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarKeepWorkingCount,True)
	End With
	.EndUpdate()
End With

VB.NET for /COM

Dim h
With AxG2antt1
	.BeginUpdate()
	.MarkSearchColumn = False
	With .Columns
		.Add("Tasks")
		.Add("Start").Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty) = 1
		.Add("End").Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty) = 543
	End With
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.LevelCount = 2
		.PaneWidth(False) = 256
		.ShowEmptyBars = 0
	End With
	With .Items
		.AllowCellValueToItemBar = True
		h = .AddItem("Task 1")
		.AddBar(h,"Task",#9/21/2006#,#9/21/2006#)
		.ItemBar(h,"",EXG2ANTTLib.ItemBarPropertyEnum.exBarEndInclusive) = .ItemBar(h,"",EXG2ANTTLib.ItemBarPropertyEnum.exBarStart)
		.ItemBar(h,"",EXG2ANTTLib.ItemBarPropertyEnum.exBarKeepWorkingCount) = True
	End With
	.EndUpdate()
End With

C++

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

	#import <ExG2antt.dll>
	using namespace EXG2ANTTLib;
*/
EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown();
spG2antt1->BeginUpdate();
spG2antt1->PutMarkSearchColumn(VARIANT_FALSE);
EXG2ANTTLib::IColumnsPtr var_Columns = spG2antt1->GetColumns();
	var_Columns->Add(L"Tasks");
	((EXG2ANTTLib::IColumnPtr)(var_Columns->Add(L"Start")))->PutDef(EXG2ANTTLib::exCellValueToItemBarProperty,long(1));
	((EXG2ANTTLib::IColumnPtr)(var_Columns->Add(L"End")))->PutDef(EXG2ANTTLib::exCellValueToItemBarProperty,long(543));
EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart();
	var_Chart->PutFirstVisibleDate("9/20/2006");
	var_Chart->PutLevelCount(2);
	var_Chart->PutPaneWidth(VARIANT_FALSE,256);
	var_Chart->PutShowEmptyBars(0);
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
	var_Items->PutAllowCellValueToItemBar(VARIANT_TRUE);
	long h = var_Items->AddItem("Task 1");
	var_Items->AddBar(h,"Task","9/21/2006","9/21/2006",vtMissing,vtMissing);
	var_Items->PutItemBar(h,"",EXG2ANTTLib::exBarEndInclusive,var_Items->GetItemBar(h,"",EXG2ANTTLib::exBarStart));
	var_Items->PutItemBar(h,"",EXG2ANTTLib::exBarKeepWorkingCount,VARIANT_TRUE);
spG2antt1->EndUpdate();

C++ Builder

G2antt1->BeginUpdate();
G2antt1->MarkSearchColumn = false;
Exg2anttlib_tlb::IColumnsPtr var_Columns = G2antt1->Columns;
	var_Columns->Add(L"Tasks");
	var_Columns->Add(L"Start")->set_Def(Exg2anttlib_tlb::DefColumnEnum::exCellValueToItemBarProperty,TVariant(1));
	var_Columns->Add(L"End")->set_Def(Exg2anttlib_tlb::DefColumnEnum::exCellValueToItemBarProperty,TVariant(543));
Exg2anttlib_tlb::IChartPtr var_Chart = G2antt1->Chart;
	var_Chart->set_FirstVisibleDate(TVariant(TDateTime(2006,9,20).operator double()));
	var_Chart->LevelCount = 2;
	var_Chart->set_PaneWidth(false,256);
	var_Chart->ShowEmptyBars = 0;
Exg2anttlib_tlb::IItemsPtr var_Items = G2antt1->Items;
	var_Items->AllowCellValueToItemBar = true;
	long h = var_Items->AddItem(TVariant("Task 1"));
	var_Items->AddBar(h,TVariant("Task"),TVariant(TDateTime(2006,9,21).operator double()),TVariant(TDateTime(2006,9,21).operator double()),TNoParam(),TNoParam());
	var_Items->set_ItemBar(h,TVariant(""),Exg2anttlib_tlb::ItemBarPropertyEnum::exBarEndInclusive,TVariant(var_Items->get_ItemBar(h,TVariant(""),Exg2anttlib_tlb::ItemBarPropertyEnum::exBarStart)));
	var_Items->set_ItemBar(h,TVariant(""),Exg2anttlib_tlb::ItemBarPropertyEnum::exBarKeepWorkingCount,TVariant(true));
G2antt1->EndUpdate();

C#

exg2antt1.BeginUpdate();
exg2antt1.MarkSearchColumn = false;
exontrol.EXG2ANTTLib.Columns var_Columns = exg2antt1.Columns;
	var_Columns.Add("Tasks");
	(var_Columns.Add("Start") as exontrol.EXG2ANTTLib.Column).set_Def(exontrol.EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,1);
	(var_Columns.Add("End") as exontrol.EXG2ANTTLib.Column).set_Def(exontrol.EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,543);
exontrol.EXG2ANTTLib.Chart var_Chart = exg2antt1.Chart;
	var_Chart.FirstVisibleDate = Convert.ToDateTime("9/20/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US"));
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(false,256);
	var_Chart.ShowEmptyBars = 0;
exontrol.EXG2ANTTLib.Items var_Items = exg2antt1.Items;
	var_Items.AllowCellValueToItemBar = true;
	int h = var_Items.AddItem("Task 1");
	var_Items.AddBar(h,"Task",Convert.ToDateTime("9/21/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("9/21/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US")),null,null);
	var_Items.set_ItemBar(h,"",exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarEndInclusive,var_Items.get_ItemBar(h,"",exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarStart));
	var_Items.set_ItemBar(h,"",exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarKeepWorkingCount,true);
exg2antt1.EndUpdate();

JavaScript

<OBJECT classid="clsid:CD481F4D-2D25-4759-803F-752C568F53B7" id="G2antt1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	G2antt1.BeginUpdate();
	G2antt1.MarkSearchColumn = false;
	var var_Columns = G2antt1.Columns;
		var_Columns.Add("Tasks");
		var_Columns.Add("Start").Def(18) = 1;
		var_Columns.Add("End").Def(18) = 543;
	var var_Chart = G2antt1.Chart;
		var_Chart.FirstVisibleDate = "9/20/2006";
		var_Chart.LevelCount = 2;
		var_Chart.PaneWidth(0) = 256;
		var_Chart.ShowEmptyBars = 0;
	var var_Items = G2antt1.Items;
		var_Items.AllowCellValueToItemBar = true;
		var h = var_Items.AddItem("Task 1");
		var_Items.AddBar(h,"Task","9/21/2006","9/21/2006",null,null);
		var_Items.ItemBar(h,"",543) = var_Items.ItemBar(h,"",1);
		var_Items.ItemBar(h,"",20) = true;
	G2antt1.EndUpdate();
</SCRIPT>

C# for /COM

axG2antt1.BeginUpdate();
axG2antt1.MarkSearchColumn = false;
EXG2ANTTLib.Columns var_Columns = axG2antt1.Columns;
	var_Columns.Add("Tasks");
	(var_Columns.Add("Start") as EXG2ANTTLib.Column).set_Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,1);
	(var_Columns.Add("End") as EXG2ANTTLib.Column).set_Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,543);
EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart;
	var_Chart.FirstVisibleDate = Convert.ToDateTime("9/20/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US"));
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(false,256);
	var_Chart.ShowEmptyBars = 0;
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
	var_Items.AllowCellValueToItemBar = true;
	int h = var_Items.AddItem("Task 1");
	var_Items.AddBar(h,"Task",Convert.ToDateTime("9/21/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("9/21/2006",System.Globalization.CultureInfo.GetCultureInfo("en-US")),null,null);
	var_Items.set_ItemBar(h,"",EXG2ANTTLib.ItemBarPropertyEnum.exBarEndInclusive,var_Items.get_ItemBar(h,"",EXG2ANTTLib.ItemBarPropertyEnum.exBarStart));
	var_Items.set_ItemBar(h,"",EXG2ANTTLib.ItemBarPropertyEnum.exBarKeepWorkingCount,true);
axG2antt1.EndUpdate();

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Chart,com_Columns,com_Items;
	anytype var_Chart,var_Columns,var_Items;
	int h;
	;

	super();

	exg2antt1.BeginUpdate();
	exg2antt1.MarkSearchColumn(false);
	var_Columns = exg2antt1.Columns(); com_Columns = var_Columns;
		com_Columns.Add("Tasks");
		COM::createFromVariant(com_Columns.Add("Start")).Def(18/*exCellValueToItemBarProperty*/,COMVariant::createFromInt(1));
		COM::createFromVariant(com_Columns.Add("End")).Def(18/*exCellValueToItemBarProperty*/,COMVariant::createFromInt(543));
	var_Chart = exg2antt1.Chart(); com_Chart = var_Chart;
		com_Chart.FirstVisibleDate(COMVariant::createFromDate(str2Date("9/20/2006",213)));
		com_Chart.LevelCount(2);
	/*should be called during the form's activate method*/ 	com_Chart.PaneWidth(0,256);
		com_Chart.ShowEmptyBars(0);
	var_Items = exg2antt1.Items(); com_Items = var_Items;
		com_Items.AllowCellValueToItemBar(true);
		h = com_Items.AddItem("Task 1");
		com_Items.AddBar(h,"Task",COMVariant::createFromDate(str2Date("9/21/2006",213)),COMVariant::createFromDate(str2Date("9/21/2006",213)));
		com_Items.ItemBar(h,"",543/*exBarEndInclusive*/,com_Items.ItemBar(h,"",1/*exBarStart*/));
		com_Items.ItemBar(h,"",20/*exBarKeepWorkingCount*/,COMVariant::createFromBoolean(true));
	exg2antt1.EndUpdate();
}

/*
public void activate(boolean _active)
{
	;

	super(_active);

	exg2antt1.Chart().PaneWidth(0,256);
}
*/

Delphi 8 (.NET only)

with AxG2antt1 do
begin
	BeginUpdate();
	MarkSearchColumn := False;
	with Columns do
	begin
		Add('Tasks');
		(Add('Start') as EXG2ANTTLib.Column).Def[EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty] := TObject(1);
		(Add('End') as EXG2ANTTLib.Column).Def[EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty] := TObject(543);
	end;
	with Chart do
	begin
		FirstVisibleDate := '9/20/2006';
		LevelCount := 2;
		PaneWidth[False] := 256;
		ShowEmptyBars := 0;
	end;
	with Items do
	begin
		AllowCellValueToItemBar := True;
		h := AddItem('Task 1');
		AddBar(h,'Task','9/21/2006','9/21/2006',Nil,Nil);
		ItemBar[h,'',EXG2ANTTLib.ItemBarPropertyEnum.exBarEndInclusive] := ItemBar[h,'',EXG2ANTTLib.ItemBarPropertyEnum.exBarStart];
		ItemBar[h,'',EXG2ANTTLib.ItemBarPropertyEnum.exBarKeepWorkingCount] := TObject(True);
	end;
	EndUpdate();
end

Delphi (standard)

with G2antt1 do
begin
	BeginUpdate();
	MarkSearchColumn := False;
	with Columns do
	begin
		Add('Tasks');
		(IUnknown(Add('Start')) as EXG2ANTTLib_TLB.Column).Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(1);
		(IUnknown(Add('End')) as EXG2ANTTLib_TLB.Column).Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(543);
	end;
	with Chart do
	begin
		FirstVisibleDate := '9/20/2006';
		LevelCount := 2;
		PaneWidth[False] := 256;
		ShowEmptyBars := 0;
	end;
	with Items do
	begin
		AllowCellValueToItemBar := True;
		h := AddItem('Task 1');
		AddBar(h,'Task','9/21/2006','9/21/2006',Null,Null);
		ItemBar[h,'',EXG2ANTTLib_TLB.exBarEndInclusive] := ItemBar[h,'',EXG2ANTTLib_TLB.exBarStart];
		ItemBar[h,'',EXG2ANTTLib_TLB.exBarKeepWorkingCount] := OleVariant(True);
	end;
	EndUpdate();
end

VFP

with thisform.G2antt1
	.BeginUpdate
	.MarkSearchColumn = .F.
	with .Columns
		.Add("Tasks")
		.Add("Start").Def(18) = 1
		.Add("End").Def(18) = 543
	endwith
	with .Chart
		.FirstVisibleDate = {^2006-9-20}
		.LevelCount = 2
		.PaneWidth(0) = 256
		.ShowEmptyBars = 0
	endwith
	with .Items
		.AllowCellValueToItemBar = .T.
		h = .AddItem("Task 1")
		.AddBar(h,"Task",{^2006-9-21},{^2006-9-21})
		.ItemBar(h,"",543) = .ItemBar(h,"",1)
		.ItemBar(h,"",20) = .T.
	endwith
	.EndUpdate
endwith

dBASE Plus

local h,oG2antt,var_Chart,var_Column,var_Column1,var_Columns,var_Items

oG2antt = form.Activex1.nativeObject
oG2antt.BeginUpdate()
oG2antt.MarkSearchColumn = false
var_Columns = oG2antt.Columns
	var_Columns.Add("Tasks")
	// var_Columns.Add("Start").Def(18) = 1
	var_Column = var_Columns.Add("Start")
	with (oG2antt)
		TemplateDef = [Dim var_Column]
		TemplateDef = var_Column
		Template = [var_Column.Def(18) = 1]
	endwith
	// var_Columns.Add("End").Def(18) = 543
	var_Column1 = var_Columns.Add("End")
	with (oG2antt)
		TemplateDef = [Dim var_Column1]
		TemplateDef = var_Column1
		Template = [var_Column1.Def(18) = 543]
	endwith
var_Chart = oG2antt.Chart
	var_Chart.FirstVisibleDate = "09/20/2006"
	var_Chart.LevelCount = 2
	// var_Chart.PaneWidth(false) = 256
	with (oG2antt)
		TemplateDef = [Dim var_Chart]
		TemplateDef = var_Chart
		Template = [var_Chart.PaneWidth(false) = 256]
	endwith
	var_Chart.ShowEmptyBars = 0
var_Items = oG2antt.Items
	var_Items.AllowCellValueToItemBar = true
	h = var_Items.AddItem("Task 1")
	var_Items.AddBar(h,"Task","09/21/2006","09/21/2006")
	// var_Items.ItemBar(h,"",543) = var_Items.ItemBar(h,"",1)
	with (oG2antt)
		TemplateDef = [Dim var_Items,h]
		TemplateDef = var_Items
		TemplateDef = h
		Template = [var_Items.ItemBar(h,"",543) = var_Items.ItemBar(h,"",1)]
	endwith
	// var_Items.ItemBar(h,"",20) = true
	with (oG2antt)
		TemplateDef = [Dim var_Items,h]
		TemplateDef = var_Items
		TemplateDef = h
		Template = [var_Items.ItemBar(h,"",20) = true]
	endwith
oG2antt.EndUpdate()

XBasic (Alpha Five)

Dim h as N
Dim oG2antt as P
Dim var_Chart as P
Dim var_Column as P
Dim var_Column1 as P
Dim var_Columns as P
Dim var_Items as P

oG2antt = topparent:CONTROL_ACTIVEX1.activex
oG2antt.BeginUpdate()
oG2antt.MarkSearchColumn = .f.
var_Columns = oG2antt.Columns
	var_Columns.Add("Tasks")
	' var_Columns.Add("Start").Def(18) = 1
	var_Column = var_Columns.Add("Start")
	oG2antt.TemplateDef = "Dim var_Column"
	oG2antt.TemplateDef = var_Column
	oG2antt.Template = "var_Column.Def(18) = 1"

	' var_Columns.Add("End").Def(18) = 543
	var_Column1 = var_Columns.Add("End")
	oG2antt.TemplateDef = "Dim var_Column1"
	oG2antt.TemplateDef = var_Column1
	oG2antt.Template = "var_Column1.Def(18) = 543"

var_Chart = oG2antt.Chart
	var_Chart.FirstVisibleDate = {09/20/2006}
	var_Chart.LevelCount = 2
	' var_Chart.PaneWidth(.f.) = 256
	oG2antt.TemplateDef = "Dim var_Chart"
	oG2antt.TemplateDef = var_Chart
	oG2antt.Template = "var_Chart.PaneWidth(False) = 256"

	var_Chart.ShowEmptyBars = 0
var_Items = oG2antt.Items
	var_Items.AllowCellValueToItemBar = .t.
	h = var_Items.AddItem("Task 1")
	var_Items.AddBar(h,"Task",{09/21/2006},{09/21/2006})
	' var_Items.ItemBar(h,"",543) = var_Items.ItemBar(h,"",1)
	oG2antt.TemplateDef = "Dim var_Items,h"
	oG2antt.TemplateDef = var_Items
	oG2antt.TemplateDef = h
	oG2antt.Template = "var_Items.ItemBar(h,\"\",543) = var_Items.ItemBar(h,\"\",1)"

	' var_Items.ItemBar(h,"",20) = .t.
	oG2antt.TemplateDef = "Dim var_Items,h"
	oG2antt.TemplateDef = var_Items
	oG2antt.TemplateDef = h
	oG2antt.Template = "var_Items.ItemBar(h,\"\",20) = True"

oG2antt.EndUpdate()

Visual Objects

local var_Chart as IChart
local var_Columns as IColumns
local var_Items as IItems
local h as USUAL

oDCOCX_Exontrol1:BeginUpdate()
oDCOCX_Exontrol1:MarkSearchColumn := false
var_Columns := oDCOCX_Exontrol1:Columns
	var_Columns:Add("Tasks")
	IColumn{var_Columns:Add("Start")}:[Def,exCellValueToItemBarProperty] := 1
	IColumn{var_Columns:Add("End")}:[Def,exCellValueToItemBarProperty] := 543
var_Chart := oDCOCX_Exontrol1:Chart
	var_Chart:FirstVisibleDate := SToD("20060920")
	var_Chart:LevelCount := 2
	var_Chart:[PaneWidth,false] := 256
	var_Chart:ShowEmptyBars := 0
var_Items := oDCOCX_Exontrol1:Items
	var_Items:AllowCellValueToItemBar := true
	h := var_Items:AddItem("Task 1")
	var_Items:AddBar(h,"Task",SToD("20060921"),SToD("20060921"),nil,nil)
	var_Items:[ItemBar,h,"",exBarEndInclusive] := var_Items:[ItemBar,h,"",exBarStart]
	var_Items:[ItemBar,h,"",exBarKeepWorkingCount] := true
oDCOCX_Exontrol1:EndUpdate()

PowerBuilder

OleObject oG2antt,var_Chart,var_Columns,var_Items
any h

oG2antt = ole_1.Object
oG2antt.BeginUpdate()
oG2antt.MarkSearchColumn = false
var_Columns = oG2antt.Columns
	var_Columns.Add("Tasks")
	var_Columns.Add("Start").Def(18,1)
	var_Columns.Add("End").Def(18,543)
var_Chart = oG2antt.Chart
	var_Chart.FirstVisibleDate = 2006-09-20
	var_Chart.LevelCount = 2
	var_Chart.PaneWidth(false,256)
	var_Chart.ShowEmptyBars = 0
var_Items = oG2antt.Items
	var_Items.AllowCellValueToItemBar = true
	h = var_Items.AddItem("Task 1")
	var_Items.AddBar(h,"Task",2006-09-21,2006-09-21)
	var_Items.ItemBar(h,"",543,var_Items.ItemBar(h,"",1))
	var_Items.ItemBar(h,"",20,true)
oG2antt.EndUpdate()