Using NI Switch Executive in Visual Basic
- Updated2023-02-21
- 2 minute(s) read
Using NI Switch Executive in Visual Basic
This topic assumes that you are using the Microsoft Visual Basic ADE to manage your code development and that you are familiar with the ADE.
Follow these steps to develop an NI Switch Executive application in Visual Basic:
- Open an existing or new Visual Basic project.
- Create files necessary for your application: form definition and event handling code (.frm), Visual Basic generic code module (.bas), or Visual Basic class module (.cls). Add these files to the project.
- Add a reference to the National Instruments Switch Executive Library, which is part of the NI Switch Executive DLL. In Visual Basic 6.0, select the Project»References menu option and NI Switch Executive Version 1.0 or NI Switch Executive Configuration API Version 1.0. If you do not see NI Switch Executive listed there, use the Browse button and browse to system32\nise.dll.
Note If NI Switch Executive does not display in the references dialog box in Visual Basic or if you are trying to use the type library in a language other than Visual Basic, you can add a reference to the nise.dll file in your system directory. - Use the Object Browser <F2> to find function prototypes and constants.
- Add NI Switch Executive function calls to your application.
- Click Run.
Example Programs
For additional information regarding NI Switch Executive examples, refer to Examples. To load an example project with Visual Basic 6.0, select File»Open Project, then select the .vbp file of your choice.
String Passing
In Visual Basic, variables of data type String do not need special modifications to be passed to NI Switch Executive functions. Visual Basic automatically appends a null character to the end of a string before passing it (by reference, because strings cannot be passed by value in Visual Basic) to a procedure or function.
Parameter Passing
By default, Visual Basic passes parameters by reference. Prepend the ByVal keyword if you need to pass by value.