title: How To Get Value of a label from a Master Page in VB.NET?
body: <p>I have a label in a master page (lblUserCode) that contains the user identity code of the person logged in. </p>
  
  <p>My Metrics page would need that user code to generate graphs for that specific person who logged in. Am I able to make use of the value of txtIdentity in the metrics page?</p>
  
  <p>If so, how?</p>
  
  <p>Thanks,</p>
  
  <p>Poch</p>
  
  <p><strong>Update 1:</strong></p>
  
  <p>I tried the Master Page property approach:</p>
  
  <p>I placed this in the Master Page:</p>
  
  <pre><code>Public Property ptyUserCode()
      Get
          Return lblUserCode.Text
      End Get
      Set(value)
          lblUserCode.Text = value
      End Set
  End Property
  </code></pre>
  
  <p>The ptyUserCode and value have green lines under them with a message saying that "Property without an 'As' clause; type of object assumed."</p>
  
  <p>In the Metrics page, I placed this:</p>
  
  <p>Dim strUserCode = CType(Page.Master, Site).ptyUserCode</p>
  
  <p>But it has a blue line underneath saying that 'ptyUserCode' is not a member of 'Site'. And true enough, my graph doesn't work :(</p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>Placed this in the Master Page:</p>
  
  <pre><code>Private _UserCode As String = lblUserCode.Text
  
  Public Property ptyUserCode() As String
      Get
          Return _UserCode
      End Get
      Set(value As String)
          _UserCode = value
      End Set
  End Property
  </code></pre>
  
  <p>And then this in the Metrics page:</p>
  
  <pre><code>Dim strUserCode = Master.ptyUserCode
  </code></pre>
  
  <p>It gives me a page error, though :( it says that "'ptyUserCode' is not a member of 'System.Web.UI.MasterPage'."</p>
  
  <p>:(</p>