July 2015
Intermediate to advanced
1300 pages
87h 27m
English
Sometimes you need to access resources by name in code. This can be accomplished via the Reflection, which is discussed in Chapter 44. The following code provides an example:
'Returns the specified resource of type String'usage:'Dim myRes As String = GetResourceByName("TestString")Function GetResourceByName(resourceName As String) As String 'An example for [Application Name].[Resource File] 'is the current app: 'MyNamespace.Resources.resx Dim rm As New ResourceManager("[Application Name].[Resource File]", Assembly.GetExecutingAssembly) Return rm.GetString(resourceName)End Function
In this case the method returns resources of type
Read now
Unlock full access