Simple Dynamic Controls Demo

This demo illustrates how to dynamically add a Label control to an ASP.NET Web page.


Note that the Label control is added at the end of the page!


Source Code
<script language="vb" runat="server">
  Sub Page_Load(sender as Object, e as EventArgs)
      Dim lblMessage as New Label()
      lblMessage.Text = "Hello, World!"
      lblMessage.Font.Bold = True
      
      Controls.Add(lblMessage)
  End Sub
</script>
	


[Return to the article]
Hello, World!