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 G2antt1.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_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 With

The 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
 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.