Version

Constraint Property (Task)

Returns or sets the constraint for this task.
Syntax
'Declaration
 
Public Property Constraint As TaskConstraint
public TaskConstraint Constraint {get; set;}
Exceptions
ExceptionDescription
SummaryTaskExceptionThrown if the property is set to an invalid value for a summary task, i.e., a value other than 'AsSoonAsPossible', 'StartNoEarlierThan', or 'FinishNoLaterThan'.
Remarks

For a summary task, only the 'AsSoonAsPossible', 'StartNoEarlierThan', and 'FinishNoLaterThan' settings are valid; attempting to set the property to any other value causes a SummaryTaskException to be thrown.

When assigning a constraint to a task causes a scheduling conflict, the TaskConstraintViolation event is fired. This event gives the listener the opportunity to cancel the operation that caused the conflict, or to remove the conflicting criteria. Other actions, such as setting the StartDateTime or EndDateTime properties, or adding a TaskDependency to the Dependencies collection, can also cause the TaskConstraintViolation event to fire if carrying out the action would cause a conflict with the constraint.

The Constraint property works in conjunction with the ConstraintDateTime property to define a date which restricts the beginning or completion of a task.

The Constraint property is used to determine its effective start date. For example, if the Constraint property is set to 'StartNoLaterThan', the StartDateTime "resolves" to the value returned from the ConstraintDateTime property. In this manner, the calculated date supercedes the value to which the StartDateTime property was set.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also