|[All code in this message is untested]
D Shen wrote:
But if I would like to do little bit different for each text_changed event, how do I do? Can I attach more than one method for each event?
Yes, but it has to be done manually.
Go to the form constructor, right underneath
TODO: Add any constructor code after InitializeComponent call and add something like the following:
this.textButtonX.TextChanged += new System.EventHandler(this.MySecondaryMethod);However, be careful. If you attach two methods to one Delegate, I can't guarantee what order they will run in or even that they will run in the same sequence each time. A lot of testing is in order here.
Unless the extra code is unrelated and it doesn't matter which sequence you run in, it might be much safer to simply have a method that works like this:
private bool AllEmpty()
return ((textBox1.Text.Length + textBox2.Text.Length + textBox3.Text.Length) == 0)
button1.Enabled = !AllEmpty()in three different event handlers.