title: JavaScript Alert in a Vb.net Class
body: <p>i have this function :</p>
  
  <pre><code>Public Sub javaMsg(ByVal message As String)
      Dim sb As New System.Text.StringBuilder()
  
      sb.Append("&lt;script type = 'text/javascript'&gt;")
  
      sb.Append("window.onload=function(){")
  
      sb.Append("alert('")
  
      sb.Append(message)
  
      sb.Append("')};")
  
      sb.Append("&lt;/script&gt;")
  
      Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "alert", sb.ToString())
  End Sub
  </code></pre>
  
  <p>i need to put it in a vb class so i can be able to use it in all my pages but i'm getting an error on "Page.ClientScript" saying that "Reference to a non-shred member requires an object reference"</p>
  
  <p>How can i solve this please :)</p>
  
  <p>Thank you !</p>