开发者

VB.net (VS 2005) User Class access to public variable of maindisplay.master.vb

开发者 https://www.devze.com 2023-01-25 15:46 出处:网络
I am attempting to access a public member of the Master page class from a User Class. In my master page, I have:

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消