Software Developer's Kit - ChemDraw

Send comments on this topic
Count Property
See Also 

Description

Member of ChemDraw Control.AltGroups.

Returns the number of AltGroups present in the AltGroups collection.

Property type

Read-only property

Syntax

Visual Basic
Public Property Count() As Long

Return Type

Long

Remarks

The property Count returns the number of AltGroups in the collection

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 AltGroup 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