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开发者_JAVA百科_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
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 as Master
when you try to access the shared member. Does it work if you reference it as MainDisplay
(note that you may need to fully-qualify the namespace or import the namespace in the mytest
class file).
精彩评论