I'm trying to come up with a way to easilly detect if a change has been made to a control on a winform. This approach works but it provides no information about what controls have been changed. Is there a way to override the TextChanged event so it will pass and EventArg which contains the name of the control that fired the event? When AccountChangedHandler executed the sender paramter contains information about the textbox such as the current value of the '.Text' property but I don't see anything about which control raised the event.
private bool _dataChanged = false;
internal TestUserControl()
{
InitializeComponent();
txtBillAddress1.TextChanged += new System.EventHandler(AccountChangedHandler);
txtBillAddress2.TextChanged += new System.EventHandler(AccountChangedHandler);
txtBillZip.TextChanged += new System.EventHandler(AccountChangedHandler);
txtBillState.TextChanged += new System.EventHandler(AccountChangedHandler);
txtBillCity.TextChanged += new System.EventHandler(AccountChangedHandler);
txtCountry.TextChanged += new System.EventHandler(AccountChangedHandler);
txtContactName.TextChanged += new System.EventHandler(AccountChangedHandler);
txtContactValue1.TextChanged += new System.EventHandler(AccountChangedHandler);
txtContactValue2.TextChanged += new System.EventHandler(AccountChangedHandler);
txtContactValue3.TextChanged += new System.EventHandler(AccountChangedHandler);
txtContactValue4.TextChanged += new System.EventHandler(AccountChangedHandler);
}
private void AccountChangedHandler(object sender, EventArgs e)
{
_dataChanged = true;
}