

| Type | Description | |||
| Variant | A string expression that indicates the key of the first link, or empty, if there are no links. |
The following VB sample enumerates the links:
With G2antt1.Items
Dim k As Variant
k = .FirstLink()
While Not IsEmpty(k)
Debug.Print "LinkKey = " & k
k = .NextLink(k)
Wend
End WithThe following C++ sample enumerates the links:
CItems items = m_g2antt.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 AxG2antt1.Items
Dim k As Object
k = .FirstLink
While (TypeOf k Is String)
System.Diagnostics.Debug.Print(k.ToString)
k = .NextLink(k)
End While
End WithThe following C# sample enumerates the links:
object k = axG2antt1.Items.FirstLink;
while (k != null)
{
System.Diagnostics.Debug.Print(k.ToString());
k = axG2antt1.Items.get_NextLink(k);
}The following VFP sample enumerates the links:
With thisform.G2antt1.Items local k k = .FirstLink do While !empty(k) ?k k = .NextLink(k) enddo endwith