Simple Example Using VB.NET to Call LabVIEW DLLs

Publish Date: May 28, 2008 | 6 Ratings | 3.00 out of 5 | Print | 1 Customer Review | Submit your review

The example program demonstrates calling a DLL created in LabVIEW from a VB.NET application. The DLL is a calculator program that allows the user to perform addition, subtraction, multiplication, division, and modulus functions. The VB.NET application consists of two text boxes for the operands and a series of buttons for the operators. The answer is displayed in the results window.

The compiled DLL exports the function:

double Calculator(double Operand1, double Operand2, unsigned short Operator);

To call this function in your VB.NET application, you must first declare the function by using the following prototype:

Declare Auto Function Calculator Lib "..\LabVIEW\LVCalculator.dll" (ByVal val1 As Double, ByVal val2 As Double, ByVal Op As Integer) As Double

*Special Note*
The VI included was developed in LabVIEW 6.1 to allow for compatibility. The DLL, however, was built and compiled in LabVIEW 7.1. This means in order to run this application, LabVIEW 7.1 Runtime Engine must be installed. This can be downloaded free on our website. A link is provided below.

This documentation is contained in README.txt.

To run this program, unzip all the files, and run the VB.NET executable (NETCallLVDLL.exe). Note that the LabVIEW DLL must reside in the \LabVIEW directory of the application.

Related Links:
LabVIEW 7.1 Run-time Engine for Windows 2000/NT/XP

Back to Top

Customer Reviews
1 Review | Submit your review

  - Jul 15, 2010

doesnt run under vb.net 2.0 you get Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.

Bookmark & Share


Downloads

Attachments:

NETCallLVDLL.exe

Requirements


Ratings

Rate this document

Answered Your Question?
Yes No

Submit