Programatically generating a "TextChanged" handler
Hi there,
I'm creating a number of tabs in a form, each of which contains a text box. As I don't know at design time how many tabs a user may configure in the app I create these programatically at run time.
The code for this is as follows:
for (int i = 0; i < TabsR; i++)
{
TabPage myTabPage = new TabPage(TabTitles[i]);
tabControl.TabPages.Add(myTabPage);
tabControl.SelectedTab = myTabPage;
myTabPage.Name = TabTitles[i].ToString();
RichTextBox MyRTF = new System.Windows.Forms.RichTextBox();
MyRTF.Dock = DockStyle.Fill;
MyRTF.Name = "RTF" + i.ToString();
MyRTF.Font = new Font(EncDec.NoteFont, 10, FontStyle.Regular);
myTabPage.Controls.AddRange(new Control[] { MyRTF });
}
My problem is that I have no way of tracking when the text in any of these text boxes changes; my question being how can I programatically create a "TextBox_TextChanged(object sender, EventArgs e)" event handler for when the change occurs?
Any help is greatly appreciated!
Kind regards,
John.
|