Add a LabVIEW Class to the Block Diagram

Updated Jul 23, 2018

Issue Details

I have already created a LabVIEW class in my project, but how do I use this class in my code? How do I instantiate objects of that class?

Solution

To use your LabVIEW class within your code, you can simply drag the class from the LabVIEW Project Explorer to your Front Panel or Block Diagram. If you drag the class to your Front Panel, it gets added as a control. If you drag the class to your Block Diagram, it gets added as a constant.

This makes your class accessible from your code, but no objects have been created yet. With LabVIEW being a datalflow language, object instantiation is handled a little bit differently as compared to other languages. Quite simply, anytime data is sent along a class wire, that data represents a particular object, or instantiation, of that class.

Figure 1. Instantiation of an object of the DemoClass. This screenshot was taken with "Highlight Execution turned on.

Additional Information

For instructions on how to create a class, refer to the tutorial in the Related Links section.

WAS THIS ARTICLE HELPFUL?

Not Helpful