property Chart.Level (Index as Long) as Level
Retrieves the level based on its index.

TypeDescription
Index as Long A long expression that indicates the index of the level being accessed.
Level A Level object being accessed.
The Level property retrieves the Level based on its index. Use the LevelCount property to specify the number of levels being displayed in the chart's header. Use the HeaderVisible property to hide the control's header bar. The control's header bar displays the levels in the chart area too. If the control displays the header bar using multiple levels the HeaderHeight property gets the height in pixels of a single level in the header bar.

The following VB sample enumerates the levels in the chart:

With Gantt1.Chart
    Dim i As Long
    For i = 0 To .LevelCount - 1
        With .Level(i)
            Debug.Print .Label
        End With
    Next
End With

The following C++ sample enumerates the levels in the chart:

CChart chart = m_gantt.GetChart();
for ( long i = 0; i < chart.GetLevelCount(); i++ )
{
	CLevel level = chart.GetLevel( i );
	OutputDebugString( V2S( &level.GetLabel() ) );
}

where the V2S function converts a Variant expression to a string expression:

static CString V2S( VARIANT* pvtDate )
{
	COleVariant vtDate;
	vtDate.ChangeType( VT_BSTR, pvtDate );
	return V_BSTR( &vtDate );
}

The following VB.NET sample enumerates the levels in the chart:

With AxGantt1.Chart
    Dim i As Long
    For i = 0 To .LevelCount - 1
        With .Level(i)
            Debug.Write(.Label())
        End With
    Next
End With

The following C# sample enumerates the levels in the chart:

for (int i = 0; i < axGantt1.Chart.LevelCount; i++)
{
	EXGANTTLib.Level level = axGantt1.Chart.get_Level(i);
	System.Diagnostics.Debug.Write(level.Label);
}

The following VFP sample enumerates the levels in the chart:

With thisform.Gantt1.Chart
    For i = 0 To .LevelCount - 1
        With .Level(i)
            wait window nowait .Label
        EndWith
    Next	
EndWith