12-24-2018 08:53 PM - edited 12-24-2018 09:07 PM
Hi,
I installed NI-VISA v18.00. and tried to create power supply control program in C++.
Refer to example code from NI-VISA "Examples\.NET\17.5\SimpleReadWrite"
I could send USB command to control Keithley power-supply 2230G properly.
but when I would like to close the connected session. the compiler show the error message as below :
error C2039: 'Dispose' : is not a member of 'NationalInstruments::Visa::MessageBasedSession'
Does anyone have idea about this? Thanks
Operation System : Win10 x64 VS2013
//my sample code
MessageBasedSession^ mbSession;
NationalInstruments::Visa::ResourceManager^ rmSession = gcnew ResourceManager();
strResource = rmSession->Find("USB?*0x2230?*INSTR");
for each (System::String^ strCom in strResource)
{
resourceID = strCom;
}
try {
mbSession = (NationalInstruments::Visa::MessageBasedSession^)rmSession->Open(resourceID);
}
catch (...) {
}
try {
mbSession->RawIO->Write("OUTP ON");
Sleep(500);
}
catch (...) {
}
Sleep(1000); //wait for Power supply stable
mbSession->Dispose(); //compile error
Solved! Go to Solution.
12-25-2018 07:22 PM
Hi CharlesL,
mbSession->Dispose();
with
delete mbSession;
Thanks and Regards,
Alysa
12-25-2018 08:27 PM