Task Creation

To create a new NI-DAQmx task, create a new instance of the Task and optionally provide a name to associate with the task, as shown in the following example:

VB.NET

Dim myTask as New Task("MyAnalogInputTask")

C#

Task myTask = new Task("MyAnalogInputTask");
Note If you provide an empty string or a null reference (Nothing in Visual Basic) for the task name, the NI-DAQmx library assigns a unique name to the task automatically.
Note Any task that you create programmatically is not accessible outside of the application. For example, you can execute two applications at the same time (or two instances of the same application) that each create a Task with the same name without any ambiguity. However, the name that you provide must not be identical to any NI-DAQmx task that is saved in Measurement & Automation Explorer (MAX) or the NI-DAQmx library throws an exception.