I am using a PXI 2532 and I am trying to control the switchboard with some program in Visual Basic.
I am using the latest Microsoft Visual Basic 2008 Express Edition to make my program.
I try to check the example code :
'Open a session to the switch module and set the topology.
niSwitchCheckErr(niSwitch_InitWithTopology(txtResourceName.Text, txtTopology.Text, VI_FALSE, VI_TRUE, switchSession))
'Configures the switch module for scanning. Refer to NI Swtiches Help for scan list syntax.
niSwitchCheckErr(niSwitch_ConfigureScanList(switchSession, txtScanList.Text, NISWITCH_VAL_BREAK_BEFORE_MAKE))
'Configures the input trigger to be software trigger.
niSwitchCheckErr(niSwitch_ConfigureScanTrigger(switchSession, 0, NISWITCH_VAL_SOFTWARE_TRIG, NISWITCH_VAL_NONE))
'Configures the switch to loop continuously through the scan list until niSwitch_Abort is called.
niSwitchCheckErr(niSwitch_SetContinuousScan(switchSession, VI_TRUE))
'Initiates the scan usings the configured scan list and triggers.
niSwitchCheckErr(niSwitch_InitiateScan(switchSession))
But It is not working, as I have to add some reference to my project.
The help says :
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
to find function prototypes and constants.
Add NI-SWITCH function calls to your application.
I am adding the reference using the Browse way of doing it. I can see the DLL file and while trying to add it as a reference I have the following error message :
A reference to C:/Program Files/IVI foundation/Bin/NISWITCH_32.dll could not be added. Please make sure that the file is accessible and that it is a valid assembly or COM component
If this component is not the good one, which is the good one I have to add to my project to add the library recognizing the NI functions ?
Thanks for your help
Regards
C.Message Edited by CLU883R on 09-17-2008 02:19 AM