property Items.NextItemBar (Item as HITEM, Key as Variant) as Variant
Gets the key of the next bar in the item.

TypeDescription
Item as HITEM A HITEM expression that indicates the handle of the item where the bars are enumerated.
Key as Variant A String expression that indicates the key of the bar.
Variant A String expression that indicates the key of the next bar in the item, or empty if there is no next bar in the item
Use the FirstItemBar and NextItemBar methods to enumerate the bars inside the item. Use the ItemBar property to access properties of the specified bar. Use the AddBar method to add new bars to the item. Use the RemoveBar method to remove a bar from an item. Use the ClearBars method to remove all bars in the item. The FirstItemBar and NextItemBar methods enumerates bars in alphabetic order of the keys. Use the ItemBar(exBarsCount) property to retrieve the number of bars in a specified item.

The following VB sample enumerates the bars in the item ( h indicates the handle of the item ):

With Gantt1
    If Not (h = 0) Then
        Dim k As Variant
        k = .Items.FirstItemBar(h)
        While Not IsEmpty(k)
            Debug.Print "Key = " & k
            k = .Items.NextItemBar(h, k)
        Wend
    End If
End With

The following C++ sample enumerates the bars in the item ( h indicates the handle of the item ):

CItems items = m_gantt.GetItems();
COleVariant vtBar = items.GetFirstItemBar(h) ;
while ( V_VT( &vtBar ) != VT_EMPTY )
{
	OutputDebugString( V2S( &vtBar ) );
	OutputDebugString( "\n" );
	vtBar = items.GetNextItemBar( h, vtBar );
}

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

static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") )
{
	if ( pv )
	{
		if ( pv->vt == VT_ERROR )
			return szDefault;

		COleVariant vt;
		vt.ChangeType( VT_BSTR, pv );
		return V_BSTR( &vt );
	}
	return szDefault;
}

The following VB.NET sample enumerates the bars in the item ( h indicates the handle of the item ):

With AxGantt1
    If Not (h = 0) Then
        Dim k As Object
        k = .Items.FirstItemBar(h)
        While TypeOf k Is String
            System.Diagnostics.Debug.Print(k.ToString)
            k = .Items.NextItemBar(h, k)
        End While
    End If
End With

The following C# sample enumerates the bars in the item ( h indicates the handle of the item ):

object k = axGantt1.Items.get_FirstItemBar(h);
while ( k != null )
{
	System.Diagnostics.Debug.Print(k.ToString());
	k = axGantt1.Items.get_NextItemBar(h, k);
}

The following VFP sample enumerates the bars in the item ( h indicates the handle of the item ):

With thisform.Gantt1
    If Not (h = 0) Then
        local k
        k = .Items.FirstItemBar(h)
        do While !empty(k)
            ?k
            k = .Items.NextItemBar(h, k)
		enddo
    Endif
EndWith

In VFP, please make sure that you are using non empty values for the keys. For instance, if you are omitting the Key parameter of the AddBar method, an empty key is missing. If you need to use the FirstItemBar and NextItemBar properties, you have to use non empty keys for the bars.