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# |
コードのコピー
|
---|---|
TaskCollection tasks = c1GanttView1.Tasks; // 新しいタスクを検索します。 int index = tasks.IndexOf("New Task"); if (index >= 0) { // 新しいタスクを削除して破棄します。 Task t = tasks[index]; tasks.RemoveAt(index); t.Dispose(); } |