Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

ResourceManager is not declared. It may be inaccessible due to its protection level Issue

Hi

 

I have a question about importing Ni Libirary to my VS 2012 project. ( Using visual basic .NET, Windows 7 and VS 2012)

 

I currently test  FindReources(NI-VISA) example project to apply some of function to my project.

 

Sample project was working fine, it was returnning resource data corrent.

 

However, when I tried to apply Find Resource function to "My project"

 

it kept appearing error message such as "ResourceManager is not declared. It may be inaccessible due to its protection level"

 

What I did was ...

 

First, I added reference to my project 

 

error2.PNG

 

 

Second, I imported "Imports NationalInstruments.VisaNS" to my vb file

 

However, error keep appearing, so I can't use function.

error.PNG

 

 

And, When I re-start VS and check Object brower

there is NI-VISA reference and error is gone

error3.PNG

 

However, When I run the project, NI.VisaNS library just disappear ...

 

error4.PNG

 


I am not really sure what this happen because Sample project from NI is working without any trouble.

 

Is there any missing step to import and use NI library ?

 

Thanks

 

0 Kudos
Message 1 of 10
(8,367 Views)

pc486,

 

If I understand you correctly, the VisaNS Class Library disappears when you build your Visual Studio application. Is this true even when creating a new, blank Visual Studio Project and adding the reference? In addition, can you please post the VB .NET code you used in your example?

 

Thank you

0 Kudos
Message 2 of 10
(8,310 Views)

Hello Bryan 

 

Thanks for Helping me 

 

I created new project and I copy and paste the parts that I wanted to use for my project( i also added the  reference )

 

I was trying to use example in VISA call "FindResources"( I have attached)

 

errorsss.PNG

 

Screen capture on the abvoe is the new temp project which I ONLY imported VISA libray and function.

 

I am currently using Windows 7, Visual Studio 2012 , and .NETFRAMEWORK 4.0.

 

Is this becuase my current system is using .NETFramework 4.0 ?

 

If I have to keep 4.0 instead using 4.5, what should i do for using VISA "FindResources" project?

 

thanks

 

 

0 Kudos
Message 3 of 10
(8,235 Views)

pc486,

 

Which version of NI-VISA do you have installed on your computer?

0 Kudos
Message 4 of 10
(8,181 Views)

visa.PNG

 

 

I download visa530full and install in the PC

 

I think, it is NI-VISA 5.4

 

 

Thanks

0 Kudos
Message 5 of 10
(8,174 Views)

Hi PC486,

 

I dont think .NET Framework works well with NI-VISA and other NI components. Change your target framework of the Visual Studio project to .NET 4.0 and I think that should fix everything.

 

Go to  Project >> Properties >> Target Framework, Select .NET Framework 4.

 

Regards,

Gautham

 

 

0 Kudos
Message 6 of 10
(8,164 Views)

Hi Gautham

Thanks for helping my technical problem.

 

This issue came from  this post 

http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/NET-Framework-4-5-Language-support-issue/td-p...

 

I would like to use  ResourceManager in the NI VISA library. 

 

However, it required to use 4.5 in order to use ResourceManager.

 

When I switch to .NET 4.5 in laptop for developing project, it was working fine.

 

However, after I install my project package to another PC, it became a problem.

 

I am not really sure how to use  .NET language support to other PC or use .NET 4.0 with ResourceManager function in the VISA library.

 

Thanks

0 Kudos
Message 7 of 10
(8,160 Views)

Hi pc486,

 

When you installed the framework did you install the complete version and not the client profile?

 

Surprised that you had to install it inspite of having VS 2012. Also is that error pop up from Windows or VS?

 

Regards,

gautham

0 Kudos
Message 8 of 10
(8,158 Views)

Hello gautham

 

Thanks for Helping me

 

There is what I have in the PC

 

In the programs and Features section I found 

 

dontnet.PNG

 

 

In the reg section I found 

 

frereg.PNG

 

From http://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx

 

I assume that Code "378758" suggests  .NET Framework 4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2

 

I am not really sure how to solve this issune 😞

 

thanks

0 Kudos
Message 9 of 10
(8,154 Views)

I just uninstalled ALL NI Driver and .NET.

then , i just re-install everything.

 

Now, I am able to select Language support to use feture of .NET 4.5

 

thanks and Happy New Yea

0 Kudos
Message 10 of 10
(8,079 Views)