Using NI-DMM 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-DMM application in Visual Basic, follow these general steps:
- Open an existing or new Visual Basic project.
- Create files necessary for your application: .frm (form definition and event handling code), .bas (Visual Basic generic code module), or .cls (Visual Basic class module) and add them to the project.
- Add a reference to the National Instruments DMM Library (NIDMM), which is part of the NI-DMM DLL. In Visual Basic 6.0, select the Project»References menu option and National Instruments DMM Library (NIDMM). If you do not see the NIDMM listed there, click Browse and locate nidmm_32.dll. You can find the installed location of the NI-DMM DLL in the NI-DMM Readme File.
- Use the Object Browser <F2> to find function prototypes and constants.
- Add NI-DMM function calls to your application.
- Run your application by clicking Run.
Example Programs
You can find the installed locations of example programs in the NI-DMM Readme File. For additional information regarding NI-DMM examples, refer to Examples.
To load an example project with Visual Basic 6.0 or later, 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-DMM 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.