Skip to main content

TdxGanttControlTasks.Delete(Integer) Method

Removes the specified task from the collection.

Declaration

procedure Delete(Index: Integer);

Parameters

Name Type Description
Index Integer

The index of the target task in the collection.

Remarks

Call the Delete procedure to delete an individual task in the collection. You can use the Count property to identify the number of tasks in the collection.

Code Examples: Delete All Tasks

The Gantt control always contains a root task, and an attempt to delete it causes an exception. The following code example iterates through all tasks and deletes all tasks except for the root:

while dxGanttControl1.DataModel.Tasks.Count > 1 do
  dxGanttControl1.DataModel.Tasks.Delete(1);

Alternatively, you can call the data model’s Tasks.Reset procedure:

  dxGanttControl1.DataModel.Tasks.Reset;
See Also