通过外接程序类访问主类资源 [英] Accessing main class resource by Add-in class
问题描述
我在Component.dll中有一个主项目作为ProjectA.
包含单个类,如下所示
--------------------------------------------
Hi,
I have a main project as ProjectA in Component.dll.
Contains single class as shown below
--------------------------------------------
public class Class1
public overridable function exmpfunc()
app.msgbox(My.Resource.str01)
End function
--------------------------------------------
我已经将Component.dll的加载项创建为ComponentEx.dll.包括了主要项目的所有资源.
现在,我在附加项目中继承了Class1,如下所示
-------------------------------------------------- --------
--------------------------------------------
I have created add-on of Component.dll as ComponentEx.dll . Included all the resources of main project.
Now I am inheriting the Class1 in add-on project as shown below
----------------------------------------------------------
public class Class1
inherits Component.Class1
public overrides function exmpfunc()
app.msgbox(My.Resource.Str01)
End function
---------------- ------------------------------------------
我的问题:是否可以访问附加类在主类中创建的字符串资源.(正如我在附加类中提到的-app.msgbox(my.resource.Str01))
*字符串资源在主类中公开.
如果我尝试执行上述代码中提到的操作,则会收到错误消息.如何访问附加解决方案中主要解决方案的字符串资源.
在此先感谢
----------------------------------------------------------
My Question : is it possible to access the string resource created in main class by add-on class .(As i have mentioned in the add-on class - app.msgbox(my.resource.Str01))
*String resource is made public in main class.
I am getting error if I tried to do as mentioned in the above code. What should I do to access string resource of main solution in add-on solution.
Thanks in advance
推荐答案
如果将主项目中的资源公开,则您应该可以执行以下操作
If the resource in main project is made public you should be able to do something like this
Dim id As String = <OtherRootNamespace>.My.Resources.<yourresource>
这篇关于通过外接程序类访问主类资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!