Creating an NI-DAQmx Task from an Existing Task in MAX

You can use the NI-DAQmx .NET library to load a task that you have already configured and saved in Measurement & Automation Explorer (MAX).

You create and configure NI-DAQmx tasks in MAX through an interactive, graphical interface, which does not require writing code. You can load tasks saved in MAX and then run the tasks in any programming language that has access to an NI-DAQmx library including C, Visual C#, Visual Basic .NET, and LabVIEW.
Complete the following steps to create a task in MAX:
  1. From the Start menu, select Start » Program Files » National Instruments » Measurement & Automation Explorer to launch MAX.
  2. In the left-hand pane, right-click Data Neighborhood and select Create New.
  3. Select NI-DAQmx Task and select Next.
  4. Follow the on-screen steps to create and configure the NI-DAQmx task.

The following code shows how to load a task saved in MAX using Visual C# or Visual Basic .NET:

VB.NET

Dim myTask as Task
myTask = DaqSystem.Local.LoadTask("mySavedTaskName")

C#

Task myTask = DaqSystem.Local.LoadTask("mySavedTaskName");
After the task is loaded, you can begin using the task. You also can make changes to the task configuration before using the task.
Note If you redistribute a program that depends on an NI-DAQmx task that is stored in MAX, you must also redistribute that stored task information. Refer to Deployment in the NI-DAQmx Help for a detailed explanation of how to redistribute NI-DAQmx applications.