Inaccessible due to its protection level

I have Visual Studio Express 2012, NETMF 4.3, and I can compile Glide fine (with 4.3 selected in the build properties).

When I try and use the example in Program.cs, I get this;

‘GHIElectronics.NETMF.Glide.Resources’ is inaccessible due to its protection level c:\users\michael\documents\visual studio 2012\Projects\MFConsoleApplication2\MFConsoleApplication2\Program.cs

What’s happening?

I’ve just copied the Glide example code. Followed the instructions!

@ mriksman - You need to use 4.2 not 4.3

This is the line throwing the errors.
// Load the window
window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window));

And I presume it’s trying to read the XML I saved in the TextFile resource…?

@ andre.marschalek - so i missed the long awaited announcement we had moved to 4.3 when?

@ mriksman - correct, do you have a resource called window with the xml in it?

[quote]window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window));
And I presume it’s trying to read the XML I saved in the TextFile resource…?[/quote]
Sounds like he added the resource as a file instead of a string.

This compiled correctly (except ‘btn’ wasn’t defined’ - I was using the examply Button XML file).

            // Create the Window XML string.
            string xml;
            xml = "<Glide Version=\"" + Glide.Version + "\">";
            xml += "<Window Name=\"window\" Width=\"320\" Height=\"240\" BackColor=\"FFFFFF\">";
            xml += "<TextBlock Name=\"title\" X=\"0\" Y=\"104\" Width=\"320\" Height=\"32\" Alpha=\"255\" Text=\"Simple Example\" TextAlign=\"Center\" TextVerticalAlign=\"Middle\" Font=\"6\" FontColor=\"000000\" BackColor=\"000000\" ShowBackColor=\"False\"/>";
            xml += "</Window>";
            xml += "</Glide>";


            // Load the window
            window = GlideLoader.LoadWindow(xml);

Tried adding resource as a String called ‘Window’. No luck. The examples say to use ‘New TextFile’…

It’s like its trying to load the Resources from Glide itself - not from my Project. Does that make sense?

When I change it to;
// Load the window
window = GlideLoader.LoadWindow(MFConsoleApplication1.Resources.GetString(MFConsoleApplication1.Resources.StringResources.Window));
And explicitly define my project name - it works.

How can I make it not have to include the project name? Why is it trying to look at Glide Resource?

And then after clicking on Resources a few times, I managed to get it back to;

            // Load the window
            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.TextFile1));

Somehow it was trying to access the Glide resources, and not my projects.

I had to select the Resources (which was underlined Blue), and right click, and go Resolve > Using

And it works :slight_smile: