ComponentOne GanttView for WinForms
Moving a Task
GanttView for WinForms Task-Based Help > Moving a Task

You can move a task at run time using the up or down arrows located on the C1GanttView toolbar or you can move tasks programmatically using the RemoveAt and Insert methods.

Move a task at run time

  1. In the grid, select the task you wish to move.
  2. Click either the Move Task Up button to move the task up or Move Task Down button to move the task down a position. In this example, we’ll click the Move Task Up once to move the task item up once.

    After clicking the Move Task Up button the Editing phase task is moved up one position.


Move a task programmatically

To move a task programmatically, complete the following:

To write code in Visual Basic

Visual Basic
Copy Code
Private Sub btnMove_Click(sender As Object, e As EventArgs)
  Dim taskindex As Integer = tasks.IndexOf("Task 1")
  Dim task1 As C1.Win.C1GanttView.Task = tasks(taskindex)
  tasks.RemoveAt(0)
  tasks.Insert(1, task1)
End Sub

To write code in C#

C#
Copy Code
private void btnMove_Click(object sender, EventArgs e)
{
   int taskindex = tasks.IndexOf("Task 1");
   C1.Win.C1GanttView.Task task1 = tasks[taskindex];
   tasks.RemoveAt(0);
   tasks.Insert(1, task1);
}
See Also