Main Site Documentation

Can't figure out why this line gives me a compilation error:


#1

 window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window));

Window is a txt file on resource folder.
The errors:

mTest.Resources’ does not contain a definition for ‘StringResources’

mTest.Resources’ does not contain a definition for ‘GetString’

following this example about glide…
https://netmfglide.codeplex.com/SourceControl/latest#Glide/Examples/ButtonExample.xml

Thanks!


#2

@ bioengproject - Did you take care of the namespace where the Resource class is assigned ?


#3

@ LouisCpro - Can you elaborate?


#4

@ bioengproject - The message can have 3 origins :

  1. The Resources class is in a different namespace than the class where you call it, so that you have to right click on the class name, and choose “Resolve using”.

  2. There was an error during the Resources creation and the given methods GetString and
    StringResources were not created. In this case, drop the resource and recreate it from scrash.

  3. You added your text file in the wrong resource type, so that it is not imported as string but maybe as binary…In this case, drop the text file in the resource and ensure you choose the “Text” type before importing it again.


#5

@ LouisCpro - Check this out, The class resource doesn’t contain these function…
How can I modify it?


#6

I remember something about this… have you read and followed: https://www.ghielectronics.com/docs/28/loading-resources


#7

@ bioengproject -

OK, it is the third reason !

Open the Resources.resx, search for you textfile and delete it, then select the Text type, and import the textfile again !


#8

This is because you added the file as a resource, rather than adding a string entry for Window. If you want it to work with a string resource, go into the Resource editor (Resources.rex) and click the drop down so that it shows string resources. For the name, place Window, and for the value place the contents of your file.


#9

@ James - You’re right, string type not text as i said :whistle: