Using NI-SWITCH 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.
To develop an NI-SWITCH application in Visual Basic, follow these general steps:
- Open an existing or new Visual Basic project.
- Create files necessary for your application and add them to the project.
- Add a reference to the National Instruments Switch Library (NISWITCH), which is part of the NI-SWITCH DLL. In Visual Basic 6.0, select the Project»References menu option and National Instruments Switch Library (NISWITCH). If you do not see NISWITCH listed there, click Browse and locate NISWITCH_32.dll in your IVI\Bin directory.
- Use the Object Browser <F2> to find function prototypes and constants.
- Add NI-SWITCH function calls to your application.
- Run your application by clicking Run.
Example Programs
To load an example project with Visual Basic 6.0 or later, select File»Open Project, then select the .vbp file of your choice.
For more information about NI-SWITCH examples, including example locations, refer to Examples.
Special Considerations
String Passing
In Visual Basic, variables of data type String do not need special modifications to be passed to NI-SWITCH functions. Visual Basic automatically appends a null character to the end of a string before passing it (by reference, since 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.