Software Developer's Kit - ChemDraw

Send comments on this topic
Item Method
See Also 
index

The location of an object in a collection, counted from the top, starting with 1.

Description

Member of ChemDraw Control.AltGroups.

Given an index, returns one AltGroup from AltGroups collection.

Syntax

Visual Basic
Public Function Item( _
   ByVal index As Long _
) As AltGroup

Parameters

index

The location of an object in a collection, counted from the top, starting with 1.

Return Type

Remarks

The property item allows referencing one AltGroup in particular from the AltGroups collection, which are the AltGroups present in the ChemDraw document. This enables all the AltGroup properties.

Example

'Shows number of AltGroups in the ChemDraw document 
 Private Sub cmdShowNumberOfAltGroups_Click() 
 Dim myAltGroup1 as ChemDrawControl10Ctl.AltGroup
 Dim myAltGroup1 as ChemDrawControl10Ctl.AltGroup 
'Checks if at least two AltGroups have been drawn
     If  ctlChemDraw.Objects.AltGroups.Count > 2 Then 
         Set MyAltGroup1 = ChemDrawControlCtl.AltGroups.Item(1)
         Set MyAltGroup2 = ChemDrawControlCtl.AltGroups.Item(2)
        'Returns the number of atoms in each AltGroup
         vMessage = MsgBox("AltGroup1 has: " & MyAltGroup1.Atoms.Count & " Atom/s" _
                       & "AltGroup2 has: " & MyAltGroup2.Atoms.Count& " Atom/s", _
                       vbInformation + vbOKOnly, "Info") 
        'Returns the number of AltGroups within the control
         Text1.text = "There are: " & format(ChemDrawControlCtl.AltGroups.Count, "##") & " AltGroup/s" 
     End If
 End Sub

See Also