I'm new to Visual Basic, and I'm having issues accessing the resource file for my project.
Dim rm As Resources.ResourceManager = New Resources.ResourceManager("MyProjectName.My.Resources.Resources", [Assembly].GetExecutingAssembly())
Dim myValue = rm.GetString(lookUpKey) 'boom Object reference not set to an instance of an object.
I think the issue is with the string "MyProjectName.My.Resources.Resources".
Would I be better off moving the strings into their own resource file?
You can access resources added through the Project Designer by using My. Resources. resourceName. You can also add or remove resource files by selecting your project in Solution Explorer and clicking Add New Item or Add Existing Item from the Project menu.
Open your project in Visual Studio and navigate to Solution Explorer. Expand the Resource Files folder, then: To open in the text editor, double-click the . manifest file.
Navigate to resources from File Structure Open a . resx file in the XML (Text) editor. Press Ctrl+Alt+F or choose ReSharper | Windows | File Structure from the main menu . Alternatively, you can press Ctrl+Shift+A , start typing the command name in the popup, and then choose it there.
I thought it was something similar to:
my.Resource.whateverhere
Is that not the kind of resources you are looking for?
Try
Global.<MyNamespace>.My.Resources.<ResourceStringName>
to access Resource Strings
Try ResourceManager("MyProjectName.Resources", ...)
, otherwise if it's the application resources you can simply use My.Resources.HD
(see here:My.Resources Object)
or
Open Reflector, load your assembly there, go to resources, a list of resources appears, search for the one containg 'HD'
, copy the name (it's like MyProjectName.Resources.resources), remove the last .resources
and try with that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With