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

   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 G2antt1.Items
    Dim k As Variant
    k = .FirstLink()
    While Not IsEmpty(k)
        Debug.Print "LinkKey = " & k
        k = .NextLink(k)
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)
        k = .NextLink(k)
    End While
End With

The following C# sample enumerates the links:

object k = axG2antt1.Items.FirstLink;
while (k != null)
	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 = .NextLink(k)


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