VB.net (VS 2005) 用户类访问 maindisplay.master.vb 的公共变量
我正在尝试从用户类访问母版页类的公共成员。
在我的母版页中,我有:
Partial Class MainDisplay
Inherits System.Web.UI.MasterPage
Public Shared m_test As Integer
...
在我的用户类中,我有:
Imports Microsoft.VisualBasic
Imports System.Web.UI.MasterPage
Public Class mytest
Public Function getValue() As Integer
Dim iRet As Integer = 0
iRet = Master.m_test ' how do i get access to the public member**
End Function
End Class
如何从用户类访问 m_test?
谢谢
I am attempting to access a public member of the Master page class from a User Class.
In my master page, I have:
Partial Class MainDisplay
Inherits System.Web.UI.MasterPage
Public Shared m_test As Integer
...
In my User Class, I have:
Imports Microsoft.VisualBasic
Imports System.Web.UI.MasterPage
Public Class mytest
Public Function getValue() As Integer
Dim iRet As Integer = 0
iRet = Master.m_test ' how do i get access to the public member**
End Function
End Class
How do I get access to m_test from the user class?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的 VB 有点生疏,但我注意到的第一件事是具有共享成员的类称为
MainDisplay
但当您尝试将其引用为Master
时访问共享成员。如果您将其引用为MainDisplay
,它是否有效(请注意,您可能需要完全限定命名空间或在mytest
类文件中导入命名空间)。My VB is a little rusty, but the first thing I notice is that the class with the shared member is called
MainDisplay
but you're referencing it asMaster
when you try to access the shared member. Does it work if you reference it asMainDisplay
(note that you may need to fully-qualify the namespace or import the namespace in themytest
class file).