Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Dim txbx(9) As TextBox
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
txbxInit()
End Sub
Private Sub txbxInit()
Dim i As Integer
For i = 0 To txbx.Length - 1
txbx(i) = New TextBox()
txbx(i).Text = "Textbox No. " & i + 1
Page.Controls(1).Controls.Add(txbx(i))
Next
End Sub
Sub changeText(ByVal index As Integer, ByVal newText As String)
If index >= 0 And index < txbx.Length Then
txbx(index).Text = newText
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
changeText(3, "Hello World")
End Sub
End Class