hi all
i am making a tabbed notepad and i have added RichTextBox At runtime.now i want to add it's sub procedural but i don't know how to add sub procedural at run time.

i want to addd sub procedural with handle textchanged event.
i had added follwig code for sub procedural but it's shows me error.

my rutime richtexbox name is Nrt(10000).

Private Sub Nrt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) handles Nrt.TextChanged 
....
....logic code....
...
End Sub

**pls help me how to add sub procedural with handle textchanged **

if the Nrt is added in runttime, then remove the Handler clause from the Sub declaration(Private Sub Nrt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)). In your code when Nrt(10000) is created,
use the AddHandler statement

AddHandler Nrt(10000).TextChanged, AddressOf Nrt_TextChanged

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.