Software Developer's Kit - ChemDraw

Send comments on this topic
Delete Method
See Also 

Description

Member of ChemDraw Control.Group.

Deletes the group.

Syntax

Visual Basic
Public Sub Delete() 

Return Type

None

Example

'Declares variable vGroup
 Dim  vGroup As ChemDrawControl10Ctl.Group
 Dim myGroup As ChemDrawControl10Ctl.Group
'Checks that there is a Group loaded in the variable
 If  Selection.Groups.Count < 1 Then
     Exit Sub
 End If
'Loads the last Group selected into the variable
 For Each myGroup In Selection.Groups
     
If  myGroup.Selected = True Then
         Set
vGroup = myGroup
    
End If
 Next

'To delete the selected Group
 
Private sub cmdDelete_Click()
     vMessage = MsgBox("Are you sure you want to delete the selected Group?", _
                vbQuestion + vbOKCancel, "Confirm")

     If  vMessage = 1 Then
         vGroup.Delete 
     End If
 End Sub

 Private Sub cmdGroupDelete_Click()
     'Deletes the objects within the group
     For  x = 1 To MyGroup.Objects.Count 

          MyGroup.Objects.Item(x).Delete
     Next x
 End Sub


'Declares variable vObject
 Dim vObject As ChemDrawControl10Ctl.Object
'Checks that there is an object loaded in the variable
 If  Selection.Objects.Count < 1 Then
     Exit Sub
 End If
'To delete the selected object
 
Private sub cmdDelete_Click()
     vMessage = MsgBox("Are you sure you want to delete the selected object?", _
                vbQuestion + vbOKCancel, "Confirm")

     If  vMessage = 1 Then
         vObject.Delete 
     End If
 End Sub

See Also