Calling LabVIEW Applications from Visual Basic Using ActiveX

Updated Oct 17, 2023

How do I enable LabVIEW as an ActiveX server so that I can call it from my Visual Basic application?

Complete the following steps to enable LabVIEW as an ActiveX server in your application and call it from Visual Basic.
  1. When building your application with the Application Builder, place a checkmark in the Enable ActiveX server checkbox on the Advanced tab.
  2. Manually register your application as an ActiveX server. To do so, run the application with the /RegServer command line option. For example, the following command creates a .tlb file for your application:
    MyApp.exe /RegServer
    Refer to the document linked below for more information about registering your application. The document refers to TestStand, but it also applies to LabVIEW.
  3. In your Visual Basic project, select References»Browse and select the .tlb file and your application, which should be in the same directory.
Refer to the Visual Basic code in the attached file to learn how to make calls to your application. You also can refer to the VBToLV.frm, VBToLV.vbp, and VBToLV.vbw files in <LabVIEW>\examples\comm for an example of calling LabVIEW as an ActiveX server from Microsoft Visual Basic.

To modify the Counter example VB code to call another LabVIEW application, you'll have to do several things. First, replace the two references to Counter in the VB code to refer to your new LabVIEW executable. Then add a reference to the new executable's .tlb file (see step 3 above).