By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,106 Members | 2,474 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,106 IT Pros & Developers. It's quick & easy.

A simple page

P: n/a
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
Dec 30 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.