property Items.FirstLink as Variant
Gets the key of the first link.

TypeDescription
Variant A string expression that indicates the key of the first link, or empty, if there are no links.
Use the FirstLink and NextLink properties to enumerate the links in the control. The FirstLink property retrieves an empty value, if there are no links 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