property G2antt.DetectDelete as Boolean
Specifies whether the control detects when a record is deleted from the bounded recordset.

 TypeDescription 
   Boolean A boolean expression that indicates whether the control detects when a record is deleted from the bounded recordset.  

By default, the DetectDelete property is False. The property has effect only if the DataSource property points to an ADO recordset ( /COM ). If the DetectDelete property is True, the control is notified when a record is deleted, and the associated item is removed from the control's items collection.

Handling the Delete method in the control, using the DAO recordset on MS Access

The code binds the control to a DAO recordset. The DetectDelete property on True, makes the control to move the current record on the item to be deleted, and to remove any reference to the record to be deleted.

Private Sub cmdRemove_Click()
    With G2antt1.Items
        .RemoveItem .FocusItem
    End With
End Sub

The code removes the focused item. The Items.RemoveItem call makes the control to fire the RemoveItem event, which will actually delete the associated record in the database, as in the following code

The code deletes the current record.

Handling the Delete method in the control, using the ADO recordset in VB

The code binds the control to an ADO recordset.

Private Sub cmdRemove_Click()
    With G2antt1.DataSource
        .Delete
    End With
End Sub

The Delete method of the recordset removes the current record ( select a new item to the control, and the current record is changed ), and due DetectDelete the associated item is removed from the view.

 


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