property G2antt.DataSource as Object
Retrieves or sets a value that indicates the data source for object.

Object An ADO or DAO Recordset object used to fill data from.
The /COM version provides ADO, ADODB and DAO database support. The DataSource property takes a recordset and add a column for each field found, and add a new item for each record in the recordset. Use the Visible property to hide a column. Use the CellValue property to retrieves the value of the cell. Use the PutItems to load an array to the control. Use the DetectAddNew property to allow adding new items to the control when the user adds new records to the table that's linked with the control. Use the ConditionalFormats method to apply formats to a cell or range of cells, and have that formatting change depending on the value of the cell or the value of a formula. Use the DefaultItemHeight property before setting a DataSource property to specify the 

The /NET version provides the following methods for data binding:

Using the data binding on /NET may change the following properties:

Click here to watch a movie on how to assign a data source to the control, in design mode, for /NET assembly.

The following VB sample binds an ADO recordset to the ExG2antt/COM control:

Set rs = CreateObject("ADODB.Recordset")
rs.Open "Orders", "Provider=Microsoft.Jet.OLEDB.3.51;Data Source= D:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB", 3 ' Opens the table using static mode

Set G2antt1.DataSource = rs

The DataSource clears the columns collection, and load the recordset to the control. Use SetParent method to make your list a hierarchy.

The following C++ sample binds a table to the control:

#include "Items.h"
#include "Columns.h"
#include "Column.h"

#pragma warning( disable : 4146 )
#import <msado15.dll> rename ( "EOF", "adoEOF" )
using namespace ADODB;

_RecordsetPtr spRecordset;
if ( SUCCEEDED( spRecordset.CreateInstance( "ADODB.Recordset") ) )
	// Builds the connection string.
	CString strTableName = "Employees", strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
	CString strPath = "D:\\Program Files\\Microsoft Visual Studio\\VB98\\NWIND.MDB";
	strConnection += strPath;
		// Loads the table
		if ( SUCCEEDED( spRecordset->Open(_variant_t( (LPCTSTR)strTableName ), _variant_t((LPCTSTR)strConnection), adOpenStatic, adLockPessimistic, NULL ) ) )
			m_g2antt.SetColumnAutoResize( FALSE );
			m_g2antt.SetDataSource( spRecordset );
	catch ( _com_error& e )
		AfxMessageBox( e.Description() );

The #import statement imports definitions for ADODB type library, that's used to fill the control. 

The following C# sample binds at runtime a table to the /NET component, using the DataSource property:

private DataTable GetTable()
    DataTable table = new DataTable();

    table.Columns.Add("Dosage", typeof(int));
    table.Columns.Add("Drug", typeof(String));
    table.Columns.Add("Patient", typeof(String));
    table.Columns.Add("DateIn", typeof(DateTime));
    table.Columns.Add("DateOut", typeof(DateTime));

    table.Rows.Add(25, "Indocin", "David", DateTime.Today, DateTime.Today.AddDays(2));
    table.Rows.Add(50, "Enebrel", "Sam", DateTime.Today.AddDays(2), DateTime.Today.AddDays(4));
    table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Today.AddDays(4), DateTime.Today.AddDays(8));
    table.Rows.Add(21, "Combivent", "Janet", DateTime.Today.AddDays(2), DateTime.Today.AddDays(6));
    table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Today.AddDays(1), DateTime.Today.AddDays(3));

    return table;


private void Form1_Load(object sender, EventArgs e)
    Exgantt1.DefaultItemHeight = 25;
    Exgantt1.DataSource = GetTable();
    Exgantt1.Chart.LevelCount = 2;

The following VB.NET sample binds at runtime a table to the /NET component, using the DataSource property:

Function GetTable() As DataTable

    Dim table As DataTable = New DataTable()

    table.Columns.Add("Dosage", GetType(Long))
    table.Columns.Add("Drug", GetType(String))
    table.Columns.Add("Patient", GetType(String))
    table.Columns.Add("DateIn", GetType(DateTime))
    table.Columns.Add("DateOut", GetType(DateTime))

    table.Rows.Add(25, "Indocin", "David", DateTime.Today, DateTime.Today.AddDays(2))
    table.Rows.Add(50, "Enebrel", "Sam", DateTime.Today.AddDays(2), DateTime.Today.AddDays(4))
    table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Today.AddDays(4), DateTime.Today.AddDays(8))
    table.Rows.Add(21, "Combivent", "Janet", DateTime.Today.AddDays(2), DateTime.Today.AddDays(6))
    table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Today.AddDays(1), DateTime.Today.AddDays(3))

    GetTable = table
End Function

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    With Exgantt1
        .DefaultItemHeight = 25
        .DataSource = GetTable()
        .Chart.LevelCount = 2
    End With
End Sub