property Items.NextLink (LinkKey as Variant) as Variant
Gets the key of the next link.

TypeDescription
LinkKey as Variant A string expression that indicates the key of the previous link
Variant A string expression that indicates the key of the next link, or empty value if there is no next link.
Use the FirstLink and NextLink properties to enumerate the links in the control. The NextLink property retrieves an empty value, if there is no next link in the control. Use the AddLink property to link two bars. Use the ShowLinks property to show or hide the links. Use the Link property to access a property of the link.

The following VB sample enumerates the links:

With Gantt1.Items
    Dim k As Variant
    k = .FirstLink()
    While Not IsEmpty(k)
        Debug.Print "LinkKey = " & k
        k = .NextLink(k)
    Wend
End With

The following C++ sample enumerates the links:

CItems items = m_gantt.GetItems();
COleVariant vtLinkKey = items.GetFirstLink() ;
while ( V_VT( &vtLinkKey ) != VT_EMPTY )
{
	OutputDebugString( V2S( &vtLinkKey ) );
	OutputDebugString( "\n" );
	vtLinkKey = items.GetNextLink( vtLinkKey );
}

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 links:

With AxGantt1.Items
    Dim k As Object
    k = .FirstLink
    While (TypeOf k Is String)
        System.Diagnostics.Debug.Print(k.ToString)
        k = .NextLink(k)
    End While
End With

The following C# sample enumerates the links:

object k = axGantt1.Items.FirstLink;
while (k != null)
{
	System.Diagnostics.Debug.Print(k.ToString());
	k = axGantt1.Items.get_NextLink(k);
}

The following VFP sample enumerates the links:

With thisform.Gantt1.Items
	local k
	k = .FirstLink
	do While !empty(k)
		?k
		k = .NextLink(k)
	enddo
endwith