property G2Host.DataField(Field as HostObjectFieldEnum) as String
Associates a data field to a property of the object of the host.

TypeDescription
Field as HostObjectFieldEnum A HostObjectFieldEnum expression that defines the property to be associated 
String A String expression that defines a data-source name, or a field to be mapped.
When you are bound the control to a data-source you can automatically loads/saves the items, tasks and links of the host. The following properties are used together to provide data-source for the control:

Based on the DataTechnology and DataSource properties, the control can use any of the following technologies:

to bound the host to a data-source.

If using the XML (Extensible Markup Language) technology, only following properties are required: 

The following sample bounds the control XML (Extensible Markup Language) way:

With G2Host1
    .DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.xml"
    .DataField(exItemsDataSource) = "Items"
End With

When using the XML (Extensible Markup Language) technology the control uses the Host's LoadXML and SaveXML to perform savings.

When using the ADO (ActiveX Data Objects) or DAO (Data Access Object)  technology, the following properties are required ( items/columns section ):

The following sample bounds the items ADO (ActiveX Data Objects) or DAO (Data Access Object) way:

With G2Host1
    .DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
    .DataMember("Items") = "Employees"
    .DataField(exItemsDataSource) = "Items"
End With

A) When using the ADO (ActiveX Data Objects) or DAO (Data Access Object), the tasks can be loaded/saved to the same data-source as items, and so only one task is possible per item, so in this case the following properties are required ( chart/tasks section ):

The following sample bounds the items and tasks (same table ) ADO (ActiveX Data Objects) or DAO (Data Access Object) way:

With G2Host1
    .DataSource("Items") = "C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb"
    .DataMember("Items") = "Employees"
    .DataField(exItemsDataSource) = "Items"
    .DataField(exTasksDataSource) = .DataField(exItemsDataSource)
    .DataField(exTasksStart) = "BirthDate"
    .DataField(exTasksEnd) = "HireDate"
End With

B) When using the ADO (ActiveX Data Objects) or DAO (Data Access Object), the tasks can be loaded/saved from a different data-source, the following properties are required ( chart/tasks section ):

in addition for items/columns section, the following is required too:

The following sample bounds the items and tasks (different tables ) ADO (ActiveX Data Objects) or DAO (Data Access Object) way:

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"
End With

When using the ADO (ActiveX Data Objects) or DAO (Data Access Object), the links can be loaded/saved from a different data-source, so the following properties are required ( chart/links section ):

in addition for chart/tasks section, the following is required too:

The following sample bounds the items, tasks and links (different tables ) ADO (ActiveX Data Objects) or DAO (Data Access Object) way:

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"
End With