Composite Controls and Events

I've created a composite control with a TextChanged event on the TextBox child control:

Namespace myControls

    Public Class TitledTextBox

        Inherits CompositeControl

        Private m_label As Label
        Private m_textBox As TextBox

        Public Property Title() As String
            Get
                Return CStr(ViewState("Title"))
            End Get
            Set(ByVal value As String)
                ViewState("Title") = value
            End Set
        End Property

        Public Property Text() As String
            Get
                Return CStr(ViewState("Text"))
            End Get
            Set(ByVal value As String)
                ViewState("Text") = value
            End Set
        End Property

        Protected Overrides Sub CreateChildControls()
            ' Add The Label
            m_label = New Label()
            m_label.EnableViewState = False
            m_label.Text = Title
            Controls.Add(m_label)

            ' Add a Space
            Controls.Add(New LiteralControl("  "))

            ' Add the text box
            m_textBox = New TextBox()
            m_textBox.EnableViewState = False
            m_textBox.Text = Text
            AddHandler m_textBox.TextChanged, AddressOf OnTextChanged
            Controls.Add(m_textBox)
        End Sub

        Public Event TextChanged As EventHandler

        Protected Overridable Sub OnTextChanged(ByVal sender As Object, ByVal e As EventArgs)
            If TextChangedEvent IsNot Nothing Then
                RaiseEvent TextChanged(Me, e)
            End If
        End Sub

    End Class
End Namespace

How do I "get at" that event. This code doesnt work:

    Sub textchanged() Handles myNewControl.TextChanged

        Label1.Text = myNewControl.Text & " - this has changed"

    End Sub

I get the following error:

BC31029: Method 'Public Sub textchanged()' cannot handle Event 'Public Event TextChanged(sender As Object, e As System.EventArgs)' because they do not have the same signature.

What is going wrong?
g-spotAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

g-spotAuthor Commented:
The problem was that I missed the paramters from the textchanged routine. Should be:

Sub textchanged(ByVal sender As Object, ByVal e As EventArgs)

    Sub textchanged(ByVal sender As Object, ByVal e As EventArgs) Handles myNewControl.TextChanged

        Label1.Text = myNewControl.Text & " - this has changed"

    End Sub
0
EE_AutoDeleterCommented:
g-spot,
Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.

EE_AutoDeleter
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.