I am trying to add some controls at runtime to a UserControl. I am using the code given in a MSDN thread last year as follows
Dim TB As New TextBox With TB.
Location = New Point(csrText1.Location).
Name = "csrInitial".
Width = csrText1.Width / 2 - 2.
Text = String.Empty.
Visible = False End With Me.Controls.Add(TB)AddHandler TB.TextChanged, AddressOf TextChanged
This gives me an error
Error 1 'AddressOf' operand must be the name of a method (without parentheses).
If I change the line to
AddHandler TB.TextChanged, AddressOf TB_TextChangedWhich reflects what is said in the VB2005 Standard Helpfile, I get an error saying TB_TextChanged is not declared.
Has anybody any idea what I am doing wrong
regards
Colin Reid

Problem with AddHandler
Gurpreet Singh Gill
Private Sub TB_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub