Creating a .NET DAQ Component with Add New Item
- Updated2023-02-17
- 3 minute(s) read
Creating a .NET DAQ Component with Add New Item
- Open the project in which you want to create a DAQ component.
- Select to launch the Add New Item dialog box.
- In the Categories pane, select Visual Basic Items if you are using Visual Basic .NET. Select Visual C# Project Items if you are using Visual C#.
- In the Templates pane, select NI DAQ Component.
- Specify a name for the DAQmx task file and click Add. If you are creating a project task, the name you choose for the file becomes the name of your task class.
-
In the Add DAQ Component Dialog box, specify one of the following options to create your DAQmx task:
- Create a new project task—This option creates a new DAQmx task in your project. The settings that you specify are not saved in Measurement & Automation Explorer (MAX) and only affect the task in the project.
- Create a new MAX task—This option creates a new DAQmx task in MAX. The settings that you specify are saved in MAX.
- Create a reference to a MAX task—This option lets you reference a DAQmx task that already exists in MAX from your current project. Any changes that are saved to this task are saved in MAX.
- Copy a MAX task to a project task—This option lets you create a copy of a DAQmx task that already exists in MAX and copy it to your current project. Any changes that you make to this task are not saved in MAX and only affect the copied task in the project.
- Copy an existing .mxb—This option lets you create a copy of a task that is specified by an existing .mxb file in another project and copy it into the current project.
- Click Finish.
- If you selected an option to create a new task, the wizard launches the DAQ Assistant. Select the measurement type for the new task in the DAQ Assistant.
- Select the channel or channels to add to the task. Click Finish.
The wizard also adds a partial class for the DAQ component which you can use to extend your application. This partial class has a .User.vb suffix for Visual Basic .NET projects and a .User.cs suffix for Visual C# projects.
Save the .mxb file to generate source code. If the DAQmx task is a project task, the DAQ Assistant generates a DAQmx task class that contains your configuration settings and a DAQ component that uses the generated task. If the DAQmx task is a MAX task, the DAQ Assistant generates a DAQ component that loads the specified MAX task from MAX.
After you create the .NET DAQ component, you can use the DAQ Assistant task configuration editor to configure the DAQmx task of the component.
Related Information
- Task Configuration Editor
- .NET DAQ Components
- Custom Methods and Properties
In addition to customizing the DAQ Component through existing methods, you can add your own custom methods and properties.
- Task Class