Software Developer's Kit - ChemDraw

Send comments on this topic
Selected Property
See Also 


Member of ChemDraw Control.ObjectTag.

Sets and returns whether this ObjectTag is selected or not.

Property type

Read-write property


Visual Basic
Public Property Selected() As Boolean

Return Type



This property returns True if the object is selected, otherwise returns False. If the property is set to False, the object will no longer be selected.


'Declares variable vObject
'Object can be any ChemDraw object
 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

 Private Sub ctlChemDraw_SelectionChanged (ByVal selection As ChemDrawControl10Ctl.IChemDrawSelection
    'this event indicates a change in the objects selected 
    'checks that there is an object loaded in the variable
     If  Selection.Objects.Count < 1 OR Selection.Objects.Count > 2 Then
         Exit Sub
vObject =  ctlChemDraw.Selection.Objects.Item(1)
     End If
 End Sub 

'another example
 Private Sub ctlChemDraw_DataChanged()
     If  ChemDrawControl10Ctl.Objects.Count >= 1 And ChemDrawControl10Ctl.Selection.Objects.Count = 1 Then
        'First contact produces an error (there is still no object selected)
         Text1.Text = vObject.Selected
     End If
 End Sub

See Also