Back to Devexpress

TdxGanttControlTasks.Delete(Integer) Method

vcl-dxganttcontroltasks-dot-tdxganttcontroltasks-dot-delete-x28-system-dot-integer-x29.md

latest2.0 KB
Original Source

TdxGanttControlTasks.Delete(Integer) Method

Removes the specified task from the collection.

Declaration

delphi
procedure Delete(Index: Integer);

Parameters

NameTypeDescription
IndexInteger

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:

delphi
while dxGanttControl1.DataModel.Tasks.Count > 1 do
  dxGanttControl1.DataModel.Tasks.Delete(1);
cpp
do {
  dxGanttControl1->DataModel->Tasks->Delete(1);
} while(dxGanttControl1->DataModel->Tasks->Count > 1);

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

delphi
dxGanttControl1.DataModel.Tasks.Reset;
cpp
dxGanttControl1->DataModel->Tasks->Reset();

See Also

TdxGanttControlTasks.Append Function

TdxGanttControlTasks.Insert Function

TdxGanttControlTasks Class

TdxGanttControlTasks Members

dxGanttControlTasks Unit