50
How do I get the start/end of the bar once the BarResize/BarResizing event occurs

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
	With G2Host1
		h = .HostEventParam(0)
		key = .HostEventParam(1)
		Debug.Print( .HostEventParam(-2) )
		Debug.Print( "Start:" )
		Debug.Print( .Host.Items.ItemBar(h,key,1) )
		Debug.Print( .HostEventParam(-2) )
		Debug.Print( "End:" )
		Debug.Print( .Host.Items.ItemBar(h,key,2) )
	End With
End Sub

With G2Host1
	With .Host.Chart
		.PaneWidth(False) = 128
		.FirstVisibleDate = #3/30/2019#
	End With
	With .Host.Items
		.AddBar .AddItem("Task"),"Task",#4/1/2019#,#4/14/2019#
	End With
End With
49
How do I get the bar/task from the cursor
' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
	With G2Host1
		Debug.Print( "Event:" )
		Debug.Print( .HostEventParam(-2) )
		With .Host
			i = .ItemFromPoint(-1,-1,c,h)
			Debug.Print( "Cell:" )
			Debug.Print( .Items.CellCaption(i,c) )
			With .Chart
				b = .BarFromPoint(-1,1)
				Debug.Print( "Bar:" )
				Debug.Print( G2Host1.Host.Items.ItemBar(i,b,0) )
			End With
		End With
	End With
End Sub


48
How do I get the cell from the cursor

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
	With G2Host1
		Debug.Print( "Event:" )
		Debug.Print( .HostEventParam(-2) )
		With .Host
			i = .ItemFromPoint(-1,-1,c,h)
			Debug.Print( "Cell:" )
			Debug.Print( .Items.CellCaption(i,c) )
		End With
	End With
End Sub


47
How can I highlights cells based on its value

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataField(exTasksColor) = "Color"
	.DataField(exTasksCaption) = "TaskName"
	With .Host
		.BeginUpdate 
		.BackColorAlternate = RGB(0,0,0)
		With .Columns.Item("Title")
			.Def(4) = 15790320
			.Width = .AutoWidth
		End With
		With .ConditionalFormats
			.Add("lower(%4) contains `manager`").Bold = True
			.Add("%3").BackColor = RGB(240,240,240)
		End With
		.Items.ExpandItem(0) = True
		With .Columns.Item("EmployeeID")
			.Width = .AutoWidth
		End With
		.EndUpdate 
	End With
End With
46
How do I programatically hide a column

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataField(exTasksColor) = "Color"
	.DataField(exTasksCaption) = "TaskName"
	.Host.Columns.Item("LastName").Visible = False
End With
45
Is it possible to get the information from the control when we click on the bar/item

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
	With G2Host1
		Debug.Print( .HostEventParam(-2) )
		With .Host
			i = .ItemFromPoint(-1,-1,c,hit)
			Debug.Print( "cell's value from cursor: " )
			Debug.Print( .Items.CellValue(i,c) )
			Debug.Print( "cell's value on col 1: " )
			Debug.Print( .Items.CellValue(i,1) )
			b = .Chart.BarFromPoint(-1,-1)
			Debug.Print( "Bar:" )
			Debug.Print( b )
			Debug.Print( "Bar Start:" )
			Debug.Print( .Items.ItemBar(i,b,1) )
			Debug.Print( "Bar End:" )
			Debug.Print( .Items.ItemBar(i,b,2) )
			Debug.Print( "Bar Caption:" )
			Debug.Print( .Items.ItemBar(i,b,3) )
		End With
	End With
End Sub

With G2Host1
	With .Host
		.Debug = True
		With .Chart.Bars.Item("Task")
			.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
			.OverlaidGroup = "Task,Progress"
		End With
	End With
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataField(exTasksColor) = "Color"
	.DataField(exTasksCaption) = "TaskName"
	.Host.Items.ExpandItem(0) = True
	With .Host.Chart
		.PaneWidth(False) = 128
		.ScrollTo #5/27/2017#,1
	End With
End With
44
How do I get the bar from the cursor

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
	With G2Host1
		Debug.Print( .HostEventParam(-2) )
		Debug.Print( .Host.Chart.BarFromPoint(-1,-1) )
	End With
End Sub

With G2Host1
	With .Host
		.VisualAppearance.Add 1,"C:\Program Files\Exontrol\ExG2Host\Sample\EBN\Assorted\wbs-ass.ebn"
		With .Chart.Bars.Item("Task")
			.Height = 15
			.Color = &H1ff0000
			.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
			.OverlaidGroup = "Task,Progress"
		End With
	End With
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataField(exTasksColor) = "Color"
	.DataField(exTasksCaption) = "TaskName"
	.Host.Items.ExpandItem(0) = True
	With .Host.Chart
		.PaneWidth(False) = 128
		.ScrollTo #5/27/2017#,1
	End With
End With
43
How do I add Start/End columns

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
	With G2Host1
		Debug.Print( .HostEventParam(-2) )
	End With
End Sub

With G2Host1
	.HostReadOnly = HostReadOnlyEnum.exHostReadWrite Or HostReadOnlyEnum.exHostAllowAddEmptyItem
	With .Host
		.SingleSel = False
		.OnResizeControl = 1
		.ScrollBars = ScrollBarsEnum.exVScrollEmptySpace Or ScrollBarsEnum.exDisableNoVertical
		With .Columns.Add("Start")
			.AllowSizing = False
			.Def(18) = 1
			.Editor.EditType = 7
		End With
		With .Columns.Add("End")
			.AllowSizing = False
			.Def(18) = 2
			.Editor.EditType = 7
		End With
		.Items.AllowCellValueToItemBar = True
		With .Chart
			.AllowCreateBar = 1
			.PaneWidth(False) = 256
			.Bars.Item("Task").OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
		End With
	End With
End With
42
How do I hide the left/items/columns part of the control

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	With .Host.Chart.Bars.Item("Task")
		.Pattern = 1
		.Color = RGB(0,0,255)
		.Def(19) = 50
	End With
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataField(exTasksColor) = "Color"
	.DataField(exTasksCaption) = "TaskName"
	.Host.Items.ExpandItem(0) = True
	.HostReadOnly = HostReadOnlyEnum.exHostReadWrite Or HostReadOnlyEnum.exHostAllowAddEmptyItem
	With .Host
		.OnResizeControl = OnResizeControlEnum.exDisableSplitter Or OnResizeControlEnum.exResizeChart
		With .Chart
			.ColumnsFormatLevel = "1"
			.PaneWidth(False) = 0
			.ScrollTo #5/27/2017#,1
		End With
	End With
End With
41
How do I hide the right/chart/tasks part of the control

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	With .Host.Chart.Bars.Item("Task")
		.Pattern = 1
		.Color = RGB(0,0,255)
		.Def(19) = 50
	End With
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataField(exTasksColor) = "Color"
	.DataField(exTasksCaption) = "TaskName"
	.Host.Items.ExpandItem(0) = True
	With .Host
		With .Chart
			.PaneWidth(True) = 0
			.OverviewVisible = 0
		End With
	End With
End With
40
How do hide the top/overview part of the control

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataField(exTasksDataSource) = .DataField(exItemsDataSource)
	.DataField(exTasksStart) = "BirthDate"
	.DataField(exTasksEnd) = "HireDate"
	With .Host
		With .Chart
			.OverviewVisible = 0
			.PaneWidth(False) = 256
			.ScrollTo #4/27/1969#,1
		End With
	End With
End With
39
How do I resize the panels

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	With .Host
		.VisualAppearance.Add 1,"C:\Program Files\Exontrol\ExG2Host\Sample\EBN\Assorted\wbs-ass.ebn"
		With .Chart.Bars.Item("Task")
			.Height = 15
			.Color = &H1ff0000
			.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
			.OverlaidGroup = "Task,Progress"
		End With
	End With
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataField(exTasksColor) = "Color"
	.DataField(exTasksCaption) = "TaskName"
	.Host.Items.ExpandItem(0) = True
	With .Host.Chart
		.PaneWidth(False) = 128
		.ScrollTo #5/27/2017#,1
	End With
End With
38
How do I lock the first column

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	With .Host
		.CountLockedColumns = 1
		.BackColorLock = .BackColorAlternate
	End With
End With
37
How do I specify a different color for the tasks ( EBN color )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	With .Host
		.VisualAppearance.Add 1,"C:\Program Files\Exontrol\ExG2Host\Sample\EBN\Assorted\wbs-ass.ebn"
		With .Chart.Bars.Item("Task")
			.Height = 15
			.Color = &H1ff0000
			.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
			.OverlaidGroup = "Task,Progress"
		End With
	End With
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataField(exTasksColor) = "Color"
	.DataField(exTasksCaption) = "TaskName"
	.Host.Items.ExpandItem(0) = True
	.Host.Chart.PaneWidth(False) = 256
	.Host.Chart.ScrollTo #5/27/2017#,1
End With
36
How do I specify a different color for the tasks ( solid color, transparent )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	With .Host.Chart.Bars.Item("Task")
		.Pattern = 1
		.Color = RGB(0,0,255)
		.Def(19) = 50
	End With
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataField(exTasksColor) = "Color"
	.DataField(exTasksCaption) = "TaskName"
	.Host.Items.ExpandItem(0) = True
	.Host.Chart.PaneWidth(False) = 256
	.Host.Chart.ScrollTo #5/27/2017#,1
End With
35
GroupBy

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataSource("Links") = .DataSource("Items")
	.DataMember("Links") = "EmployeeLinks"
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
	With .Host
		.AllowGroupBy = True
		.SortBarVisible = True
		.BackColorSortBar = G2Host1.Host.BackColor
		.BackColorSortBarCaption = .BackColorSortBar
		.SortBarCaption = "<sha ;;0><fgcolor=FF0000>Drag a <b>column</b> header here to sort by that column."
		With .Chart.Bars.Item("Task")
			.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
			.OverlaidGroup = "Task,Progress"
		End With
		.Items.ExpandItem(0) = True
		.CountLockedColumns = 1
		.BackColorLock = .BackColorAlternate
		With .Columns.Item("EmployeeID")
			.AllowGroupBy = False
			.Def(7) = G2Host1.Host.BackColorAlternate
		End With
		.Columns.Item("Title").SortOrder = 1
	End With
	.Host.Chart.ScrollTo #5/27/2017#,1
End With
34
How can I hide a column
' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.Host.Columns.Item(0).Visible = False
End With
33
Can row errors being highligted until the user correct them, not to clear them as soon a change occurs

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.HostDef(exErrorClearOnChange) = False
End With
32
No error is highligthed

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
End With
31
I've noticed that rows with errors are shown in red. Is it possible to change the colors

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.HostDef(exErrorBackColor) = 0
	.HostDef(exErrorForeColor) = 16777215
End With
30
Is it possible to rename the (New) to something else

With G2Host1
	.HostDef(exNew) = "*"
	With .Host
		.BeginUpdate 
		.Items.AddItem "A"
		.Items.AddItem "B"
		.EndUpdate 
	End With
	.Refresh 
End With
29
How can I hide the (New) item (sample 2)

With G2Host1
	.HostReadOnly = HostReadOnlyEnum.exHostAllowUpdate Or HostReadOnlyEnum.exHostAllowDelete
	With .Host
		.BeginUpdate 
		.Items.AddItem "A"
		.Items.AddItem "B"
		.EndUpdate 
	End With
End With
28
How can I hide the (New) item (sample 1)

With G2Host1
	.HostDef(exNew) = ""
	With .Host
		.BeginUpdate 
		.Items.AddItem "A"
		.Items.AddItem "B"
		.EndUpdate 
	End With
	.Refresh 
End With
27
Read-Only

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.HostReadOnly = exHostReadOnly
End With
26
How can I prevent user create new /delete tasks ( only move or resize then )
' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataSource("Links") = .DataSource("Items")
	.DataMember("Links") = "EmployeeLinks"
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
	With .Host.Chart.Bars.Item("Task")
		.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
		.OverlaidGroup = "Task,Progress"
	End With
	.Host.Items.ExpandItem(0) = True
	.HostReadOnly = exHostAllowUpdate
	.Host.Chart.ScrollTo #5/27/2017#,1
End With
25
How do I get the row/item/task/link from the cursor

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
	With G2Host1
		Debug.Print( .HostContext.ToString )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.HostReadOnly = HostReadOnlyEnum.exHostAllowUpdate Or HostReadOnlyEnum.exHostAllowAddNew
End With
24
Disable Delete
' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.HostReadOnly = HostReadOnlyEnum.exHostAllowUpdate Or HostReadOnlyEnum.exHostAllowAddNew
End With
23
Disable AddNew

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.HostReadOnly = HostReadOnlyEnum.exHostAllowUpdate Or HostReadOnlyEnum.exHostAllowDelete
End With
22
ACCDB sample ( file )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataSource("Links") = .DataSource("Items")
	.DataMember("Links") = "EmployeeLinks"
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
	With .Host.Chart.Bars.Item("Task")
		.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
		.OverlaidGroup = "Task,Progress"
	End With
	.Host.Items.ExpandItem(0) = True
	.Host.Chart.ScrollTo #5/27/2017#,1
End With
21
MDB sample ( file )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.mdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataSource("Links") = .DataSource("Items")
	.DataMember("Links") = "EmployeeLinks"
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
	With .Host.Chart.Bars.Item("Task")
		.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
		.OverlaidGroup = "Task,Progress"
	End With
	.Host.Items.ExpandItem(0) = True
	.Host.Chart.ScrollTo #5/27/2017#,1
End With
20
DBF sample ( file )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.dbf"
	.DataField(exItemsDataSource) = "Items"
End With
19
DAO sample ( object, DAO.DBEngine.120, multiple tasks, multiple tables )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	With CreateObject("DAO.DBEngine.120")
		With .OpenDatabase("C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb")
			Set rsEmployees = .OpenRecordset("Employees")
			Set rsTasks = .OpenRecordset("EmployeeDetails")
			Set rsLinks = .OpenRecordset("EmployeeLinks")
		End With
	End With
	.DataSource("Items") = rsEmployees
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataSource("Tasks") = rsTasks
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataSource("Links") = rsLinks
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
	With .Host.Chart.Bars.Item("Task")
		.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
		.OverlaidGroup = "Task,Progress"
	End With
	.Host.Items.ExpandItem(0) = True
	.Host.Chart.ScrollTo #5/27/2017#,1
End With
18
DAO sample ( file, multiple tasks, multiple tables )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataTechnology("Items") = "DAO.DBEngine.120;DAO.DBEngine.36"
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataTechnology("Tasks") = "DAO.DBEngine.120;DAO.DBEngine.36"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataTechnology("Links") = "DAO.DBEngine.120;DAO.DBEngine.36"
	.DataSource("Links") = .DataSource("Items")
	.DataMember("Links") = "EmployeeLinks"
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
	With .Host.Chart.Bars.Item("Task")
		.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
		.OverlaidGroup = "Task,Progress"
	End With
	.Host.Items.ExpandItem(0) = True
	.Host.Chart.ScrollTo #5/27/2017#,1
End With
17
DAO sample ( object, DAO.DBEngine.120, single task, single table )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	With CreateObject("DAO.DBEngine.120")
		With .OpenDatabase("C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb")
			Set rsEmployees = .OpenRecordset("Employees")
			Set rsLinks = .OpenRecordset("EmployeeLinks")
		End With
	End With
	.DataSource("Items") = rsEmployees
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataField(exTasksDataSource) = .DataField(exItemsDataSource)
	.DataField(exTasksStart) = "BirthDate"
	.DataField(exTasksEnd) = "HireDate"
	.DataSource("Links") = rsLinks
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
End With
16
DAO sample ( file, single task, single table )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataTechnology("Items") = "DAO.DBEngine.120;DAO.DBEngine.36"
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataField(exTasksDataSource) = .DataField(exItemsDataSource)
	.DataField(exTasksStart) = "BirthDate"
	.DataField(exTasksEnd) = "HireDate"
	.DataTechnology("Links") = "DAO.DBEngine.120;DAO.DBEngine.36"
	.DataSource("Links") = .DataSource("Items")
	.DataMember("Links") = "EmployeeLinks"
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
End With
15
DAO sample ( tree recordset )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataTechnology("Items") = "DAO.DBEngine.120;DAO.DBEngine.36"
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
End With
14
DAO sample ( flat recordset )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	With CreateObject("DAO.DBEngine.120")
		With .OpenDatabase("C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb")
			Set rsEmployees = .OpenRecordset("Employees")
		End With
	End With
	.DataSource("Items") = rsEmployees
	.DataField(exItemsDataSource) = "Items"
End With
13
DAO sample ( flat )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataTechnology("Items") = "DAO.DBEngine.120;DAO.DBEngine.36"
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
End With
12
ADO sample ( object, ADODB.Recordset, multiple tasks )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	Set rsEmployees = CreateObject("ADODB.Recordset")
	rsEmployees.Open "Employees","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb",3,3
	.DataSource("Items") = rsEmployees
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	Set rsTasks = CreateObject("ADODB.Recordset")
	rsTasks.Open "EmployeeDetails","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb",3,3
	.DataSource("Tasks") = rstasks
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	Set rsLinks = CreateObject("ADODB.Recordset")
	rsLinks.Open "EmployeeLinks","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb",3,3
	.DataSource("Links") = rsLinks
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
	With .Host.Chart.Bars.Item("Task")
		.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
		.OverlaidGroup = "Task,Progress"
	End With
	.Host.Items.ExpandItem(0) = True
	.Host.Chart.ScrollTo #5/27/2017#,1
End With
11
ADO sample ( file, multiple tasks, multiple tables )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataTechnology("Items") = "ADODB.Recordset;ADOR.Recordset"
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataTechnology("Tasks") = "ADODB.Recordset;ADOR.Recordset"
	.DataSource("Tasks") = .DataSource("Items")
	.DataMember("Tasks") = "EmployeeDetails"
	.DataField(exTasksDataSource) = "Tasks"
	.DataField(exTasksItemID) = "EmployeeID"
	.DataField(exTasksStart) = "DateStart"
	.DataField(exTasksEnd) = "DateEnd"
	.DataField(exTasksID) = "TaskID"
	.DataTechnology("Links") = "ADODB.Recordset;ADOR.Recordset"
	.DataSource("Links") = .DataSource("Items")
	.DataMember("Links") = "EmployeeLinks"
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
	With .Host.Chart.Bars.Item("Task")
		.OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStackAutoArrange Or OverlaidBarsTypeEnum.exOverlaidBarsStack
		.OverlaidGroup = "Task,Progress"
	End With
	.Host.Items.ExpandItem(0) = True
	.Host.Chart.ScrollTo #5/27/2017#,1
End With
10
ADO sample ( object, ADODB.Recordset, single task, single table )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	Set rsEmployees = CreateObject("ADODB.Recordset")
	rsEmployees.Open "Employees","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb",3,3
	.DataSource("Items") = rsEmployees
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataField(exTasksDataSource) = .DataField(exItemsDataSource)
	.DataField(exTasksStart) = "BirthDate"
	.DataField(exTasksEnd) = "HireDate"
	Set rsLinks = CreateObject("ADODB.Recordset")
	rsLinks.Open "EmployeeLinks","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb",3,3
	.DataSource("Links") = rsLinks
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
End With
9
ADO sample ( file, single task, single table )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataTechnology("Items") = "ADODB.Recordset;ADOR.Recordset"
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
	.DataField(exTasksDataSource) = .DataField(exItemsDataSource)
	.DataField(exTasksStart) = "BirthDate"
	.DataField(exTasksEnd) = "HireDate"
	.DataTechnology("Links") = "ADODB.Recordset;ADOR.Recordset"
	.DataSource("Links") = .DataSource("Items")
	.DataMember("Links") = "EmployeeLinks"
	.DataField(exLinksDataSource) = "Links"
	.DataField(exLinksStart) = "Start"
	.DataField(exLinksEnd) = "End"
End With
8
ADO sample ( tree recordset )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataTechnology("Items") = "ADODB.Recordset;ADOR.Recordset"
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
	.DataField(exItemsID) = "EmployeeID"
	.DataField(exItemsParentID) = "ReportsTo"
End With
7
ADO sample ( flat recordset )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	Set rsEmployees = CreateObject("ADODB.Recordset")
	rsEmployees.Open "Employees","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb",3,3
	.DataSource("Items") = rsEmployees
	.DataField(exItemsDataSource) = "Items"
End With
6
ADO sample ( flat table )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataTechnology("Items") = "ADODB.Recordset;ADOR.Recordset"
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
	.DataMember("Items") = "Employees"
	.DataField(exItemsDataSource) = "Items"
End With
5
XML sample ( object, MSXML.DOMDocument )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	Set xml = CreateObject("MSXML.DOMDocument")
	xml.async = False
	xml.load "C:\Program Files\Exontrol\ExG2Host\Sample\sample.xml"
	.DataSource("Items") = xml
	.DataField(exItemsDataSource) = "Items"
	With .Host
		.LinesAtRoot = -1
		.SingleSel = False
		.AutoDrag = 3
	End With
End With
4
XML sample ( file tree )

' Error event - Fired when an internal error occurs.
Private Sub G2Host1_Error(ByVal Error As Long,ByVal Description As String)
	With G2Host1
		Debug.Print( Error )
		Debug.Print( Description )
	End With
End Sub

With G2Host1
	.DataTechnology("Items") = "MSXML.DOMDocument"
	.DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.xml"
	.DataField(exItemsDataSource) = "Items"
	With .Host
		.LinesAtRoot = -1
		.SingleSel = False
		.AutoDrag = 3
	End With
End With
3
How can I let user create new items/bars when clicking the empty area of the control
' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
	With G2Host1
		Debug.Print( .HostEventParam(-2) )
	End With
End Sub

With G2Host1
	.HostReadOnly = HostReadOnlyEnum.exHostReadWrite Or HostReadOnlyEnum.exHostAllowAddEmptyItem
	With .Host
		.ScrollBars = ScrollBarsEnum.exVScrollEmptySpace Or ScrollBarsEnum.exDisableNoVertical
		With .Chart
			.PaneWidth(False) = 128
			.AllowCreateBar = 1
		End With
	End With
End With
2
How do I handle events of the host

' HostEvent event - Notifies the application once the host fires an event.
Private Sub G2Host1_HostEvent(ByVal EventID As EXG2HOSTLibCtl.HostEventEnum)
	With G2Host1
		Debug.Print( .HostEventParam(-2) )
	End With
End Sub

With G2Host1
	With .Host
		.BeginUpdate 
		.Columns.Add "new column"
		.EndUpdate 
	End With
End With
1
How can I get the version of the host/exg2antt control

With G2Host1
	Debug.Print( .Version )
	Debug.Print( "Host" )
	Debug.Print( .Host.Version )
End With