Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxGanttControlTasks.Delete(Integer) Method

Removes the specified task from the collection.

#Declaration

Delphi
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