

| Type | Description | |||
| Item as HITEM | A HITEM expression that indicates the handle of the item where the bars are enumerated. | |||
| Variant | A String expression that indicates the key of the first bar in the item, or empty if the item contains no bar. | 
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 WithThe 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
EndWithIn 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.