Features > Task Management > Constraints |
Constraints define the degree or extent to which a task can be rescheduled in a project schedule. This feature helps users in scheduling automatic tasks on the basis of various factors such as start and finish date, type of constraint, task priority and duration. Constraints cannot be applied to manual tasks. This is because GanttView does not schedule manual tasks, so applying constraints on them has no effect.
You can add constraints in GanttView to schedule automatic tasks by setting the ConstraintDate and ConstraintType properties (available in the Task class) for a particular task. The ConstraintDate property specifies the start or finish date for the applied constraint, while ConstraintType property specifies the type of constraint. The ConstraintType property accepts the following values from the ConstraintType enumeration:
Enumeration Value | Description |
Default | Allows you to schedule the task as soon as possible if the project is scheduled from the start date; Or schedules the task as late as possible if the project is scheduled from the finish date. |
FinishNoEarlierThan | Allows you to schedule tasks in a way that they must finish on or after the defined constraint date. |
FinishNoLaterThan | Allows you to schedule tasks in a way that they must finish on or before the defined constraint date. |
MustFinishOn | Allows you to schedule tasks such that they must finish on the defined constraint date. |
MustStartOn | Allows you to schedule tasks such that they must start on the defined constraint date. |
StartNoEarlierThan | Allows you to schedule tasks such that they must start on or after the constraint date. |
StartNoLaterThan | Allows you to schedule tasks such that they must start on or before the constraint date. |
To apply constraints, you need to set the ConstraintDate and ConstraintType properties in code. The following example uses the sample created in the Quick Start.
'Applying constraints t.ConstraintDate = New DateTime(2016, 5, 5) t.ConstraintType = ConstraintType.MustFinishOn
//Applying constraints t.ConstraintDate = new DateTime(2016, 5, 5); t.ConstraintType = ConstraintType.MustFinishOn;