Using NI-DCPower in Visual Basic

NI DC Power Supply & SMU

Using NI-DCPower 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-DCPower application in Visual Basic, follow these general steps:

  1. Open an existing or new Visual Basic project.
  2. 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). Add these files to the project.
  3. Add a reference to the National Instruments DCPower Library (NIDCPower), which is part of the NI-DCPower DLL. In Visual Basic 6.0, select the Project»References menu option and NI-DCPower. If you do not see NI-DCPower listed there, use the Browse button and browse to <IVI>\bin\nidcpower_32.dll.
  4. Use the Object Browser <F2> to find function prototypes and constants.
  5. Add NI-DCPower function calls to your application.
  6. Click Run.

Example Programs

For additional information regarding NI-DCPower 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-DCPower 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.