# Tasks - Best Practices

The following are guidelines when configuring Tasks for your project.

- For the best performance and results, Cognex recommends only using one Task per inspection; creating more than one Task per inspection is not recommended.
- Instead of using more than one Task, use a Sub Task block.
- Use if statements instead of exceptions, because exceptions will effect performance. For example, if a VisionPro Tool Block is configured with a CogIDTool that has Results[0] as an output, and the inspection fails to detect anything, calling Results[0] will result in an exception.
- Do not directly access a Page element property from a Task (e.g. $Pages.Page.TextBox.Text); instead, bind the property (e.g. .Text) to an intermediate tag. Using the intermediate tag will help prevent performance and cross-thread issues.

- While Task Mode supports a Continuous option, Cognex recommends that Continuous mode not be used for deployed applications. Instead of using Continuous mode, when acquiring from a Camera Device, set the camera's Trigger to Free Run, and the Task Mode to Event > ImageAcquired (e.g. $Devices.Camera1.ImageAcquired).

  Note: For more information, see the Acquiring Images Continuously topic.

- Instead of manually polling a device, set a tag's Selected Path to the device.

  Note: For more information, see the Device Paths topic.

- To poll an I/O device that is not listed under the Devices node of the Project Explorer, a High Precision Timer can be used.

  Note: For more information about configuring a High Precision Timer, see the Timers topic.
- A Task may not be forced to stop.