Imports System Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.HtmlControls Public Class myPage Inherits Page Dim txtTextBox As New TextBox Dim lblLabel As New Label Protected Overrides Sub CreateChildControls ' Add Opening HTML Tags Dim strOpenHTML As String strOpenHTML = "My Page" strOpenHTML &= "Enter some text:" Controls.Add( New LiteralControl( strOpenHTML ) ) ' Add HTMLForm Tag Dim frmForm As New HTMLForm frmForm.ID = "myForm" Controls.Add( frmForm ) ' Add a TextBox txtTextBox.ID = "myTextBox" frmForm.Controls.Add( txtTextBox ) ' Add a Button Dim btnButton As New Button btnButton.Text = "Click Here!" AddHandler btnButton.Click, AddressOf Button_Click frmForm.Controls.Add( btnButton ) ' Add Page Break frmForm.Controls.Add( New LiteralControl( "

" ) ) ' Add a Label lblLabel.ID = "myLabel" frmForm.Controls.Add( lblLabel ) ' Add Closing HTML Tags Dim strCloseHTML As String strCloseHTML = "" Controls.Add( New LiteralControl( strCloseHTML ) ) End Sub Sub Button_Click( s As Object, e As EventArgs ) lblLabel.Text = txtTextBox.Text End Sub End Class