Generating and Viewing Source Code
- Updated2023-02-17
- 2 minute(s) read
Generating and Viewing Source Code
Note When you use the DAQ Assistant configuration editor to make changes to the DAQmx task, the
.mxb file is saved and the DAQ component code is regenerated. If you make changes directly to the generated source file, those changes are lost when the source code for the
.mxb file is regenerated. To enhance or extend the code that the DAQ Assistant generates, you can use the component partial class that the DAQ Component wizard adds to your project. This partial class has a
.User.vb suffix for Visual Basic .NET projects and a
.User.cs suffix for Visual C# projects.
The DAQ component class code is contained in a .vb or .cs source code file in the project. This source code file has the same base name as the .mxb file, but has an extension that corresponds to the language of the source code. Complete the following steps to view the source code of the component.
- In Visual Basic .NET, select Show All Files in the Solution Explorer toolbar. This step is not necessary in Visual C#.
- In the Solution Explorer, expand the .mxb file node.
- Double-click the .vb or .cs file to view the code. If the DAQmx task is a project task, the generated task configuration code has the same name as the .mxb file. The DAQ component has the same name as the .mxb file and a Component suffix. For example, if you have an .mxb file that represents a project task, the DAQmx task configuration code class is named MyTask, and the DAQ component class is named MyTaskComponent.
- Right-click the .User.vb file in Visual Basic .NET or .User.cs file in Visual C# and select View Code to view or edit the code for your component partial class.
The code is automatically regenerated every time you change and save the .mxb file. To explicitly regenerate the source code, right-click the .mxb file and select Run Custom Tool.
Related Information
- Generating a .NET DAQ Component User Interface
The DAQ UI Generation Wizard creates a user interface that is appropriate for your configured DAQ component and integrates it in a Windows Forms Form class in your project.