.NET Gadgeteer now supports v4.2 of NetMF, which means that you can now code in VB! For those of you that use the Resources feature you may notice that there is a slight bug.
For example importing and using an image as a resource does not work as expected (if you come from C# land).
Create a project and go to the project properties. Use the ‘Add Resource’ option at the top to add an image (or text, icon, text file). I have added two images here.
Normally you would just be able to use the the resource by calling the resources object:
However as you type ‘Resources’ intelisense lets you know something is up.. You want the object not the namespace?? Ok so what is up here.
If you look at the code that is generated behind (when you import a resource) you can see that a Namespace has been added to the code. The Namespace is the name of the project, in my case ‘Resource Check’ – ok it is just my debug naming.
TIP: Resources.Designer.vb is not listed as a project file (it is auto generated and changes will be discarded) but you can see it if you look in the file system.
Since your resources are in a Namespace the easiest way to use them is to reference them using the full name. For example, intelisense helps at this stage showing that I have two resources:
The resulting code is as follows:
(‘Resource_check’ is my project name – make sure you use your project name)
Since I started this article I noticed this post:
The post recommends removing the Namespace declaration from the auto generated Resource.Designer.vb file but this will just get over written every time you add a resource.
James has added a comment regarding a fix which is to declare the namespace in the Project.vb file. Such as:
If you do this then you will also need to add it to the Program.generated.vb file as well. (This file is auto generated, changes will get overwritten)
Hope that helps!