Generic Event Handler

C

Chris

I want to create a generic event handler for some controls I am dynamically
adding via a class. My class compiles OK but when I change the text in the
textboxes it doesn't do anything. What am I doning wrong. Regards.

Here is the loop adding the textbox and event handler

Loop
Dim txt As TextBox = New TextBox()
txt.Text = strcontrolid
txt.ID = strcontrolid
Form1.Controls.Add(txt)
AddHandler txt.TextChanged, AddressOf Generic_TextChanged
End Loop

Private Sub Generic_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim txt As TextBox = sender
txt.Text = "test"
HttpContext.Current.Response.Write("test")
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top