S
Slim
I have a simple page with a button.
when the button is clicked it creates a new button, all works fine so far
When the second button is clicked it should create a third button, but this
is where it fails.
How should I go about getting this to work
Partial Class test_buttons
Inherits System.Web.UI.Page
Dim bt2 As Button
Dim bt3 As Button
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
bt2 = New Button
bt2.Text = "Button2"
AddHandler bt2.Click, AddressOf bt2Click
form1.Controls.Add(bt2)
End Sub
Sub bt2Click(ByVal sender As Object, ByVal e As System.EventArgs)
bt3 = New Button
bt3.Text = "Button3"
form1.Controls.Add(bt3)
End Sub
End Class
when the button is clicked it creates a new button, all works fine so far
When the second button is clicked it should create a third button, but this
is where it fails.
How should I go about getting this to work
Partial Class test_buttons
Inherits System.Web.UI.Page
Dim bt2 As Button
Dim bt3 As Button
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
bt2 = New Button
bt2.Text = "Button2"
AddHandler bt2.Click, AddressOf bt2Click
form1.Controls.Add(bt2)
End Sub
Sub bt2Click(ByVal sender As Object, ByVal e As System.EventArgs)
bt3 = New Button
bt3.Text = "Button3"
form1.Controls.Add(bt3)
End Sub
End Class