title: Codebehind does not set <asp:label> Text in Page_Load
body: <p>I am trying to design a form using VB.Net for WebForms. I have been following the following link <a href="https://stackoverflow.com/questions/6552908/my-labels-text-isnt-changing-on-page-load-asp-net">My label&#39;s text isn&#39;t changing on page_load asp.net</a>. But the solution there is not working for me. I already have <code>Handles Me.Load</code> defined for my <code>Page_Load</code> event handler, however the result is a "blank" page, with the HTML output below.</p>
  
  <p><strong>form.aspx:</strong></p>
  
  <pre><code>&lt;%@ Page Language="vb" AutoEventWireup="false" CodeBehind="form.aspx.vb" Inherits="MyApp.form" %&gt;
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;Test&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;asp:Label id="vcode" runat="server" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>form.aspx.vb:</strong></p>
  
  <pre><code>Imports System.Web
  
  Public Class form
      Inherits System.Web.UI.Page
  
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
          vcode.Text = "Why not?"
      End Sub
  
  End Class
  </code></pre>
  
  <p><strong>HTML Output:</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;&lt;title&gt;
      Test
  &lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
      &lt;span id="vcode"&gt;&lt;/span&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I suspect it has to do with the <code>Inherits</code> attribute, but if I take out <code>Page_load</code> from that class definition, I get an error:</p>
  
  <blockquote>
    <p>Statement is not valid in a namespace</p>
  </blockquote>
  
  <p>I also tried setting the <code>AutoEventWireup</code> attribute on the page to true, but no change.. still blank label.</p>
  
  <p>What am I missing here?</p>