title: Loading user controls programatically into a placeholder (asp.net)
body: <p>In my .aspx page I have;</p>
  
  <pre><code>    &lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" AspCompat="True" %&gt;
  
      &lt;%@ Register src="Modules/Content.ascx" tagname="Content" tagprefix="uc1" %&gt;
  
      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
      &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
          &lt;div&gt;
          &lt;asp:PlaceHolder ID="Modulecontainer" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
          &lt;/div&gt;
          &lt;/form&gt;
      &lt;/body&gt;  
  &lt;/html&gt;
  </code></pre>
  
  <p>In my aspx.vb I have; </p>
  
  <pre><code>    Try
          Dim loadmodule As UserControl
          loadmodule = Me.LoadControl("~/modules/content.ascx")
          Modulecontainer.Controls.Add(loadmodule)
      Catch ex As Exception
          Response.Write(ex.ToString &amp; "&lt;br /&gt;")
      End Try
  </code></pre>
  
  <p>The result is an empty placeholder and no errors.</p>
  
  <p>Thanks a lot for any assistance</p>
  
  <p>P.S after Fat_Tony's answer I changed the code to;</p>
  
  <pre><code>Try
              Dim loadmodule As ASP.ContentModule
              loadmodule = CType(LoadControl("~\Modules\Content.ascx"), ASP.ContentModule)
              Modulecontainer.Controls.Add(loadmodule)
          Catch ex As Exception
              Response.Write(ex.ToString &amp; "&lt;br /&gt;")
          End Try
  </code></pre>
  
  <p>But still no results unfortunately.</p>