Working with GanttView / Task Operations / Delete Tasks
Delete Tasks

To delete a task, you can use the RemoveAt method of the Collection class by specifying the index of the task that you want to remove. Other than this, you can also delete a task at run time by clicking on the Delete button from the C1GanttView toolbar.

The below code snippet shows how you can delete a task programmatically.

C#
Copy Code
TaskCollection tasks = c1GanttView1.Tasks;
 
    // find NewTask
    int index = tasks.IndexOf("New Task");
    if (index >= 0)
    {
        // delete and dispose the new task
        Task t = tasks[index];
        tasks.RemoveAt(index);
        t.Dispose();
    }