Originally Posted by
Bubba
Be careful with events. Let's say you have a text changed event handler for a text box. Anytime you set the Text property of that text box the handler for that event will be called. This can lead to some strange event loops that yield very strange results. Some controls like the TreeView control allow you to account for this by using internal member variables that determine the cause of the change of a property. In custom handlers Microsoft recommends using a boolean to indicate the change was made from code instead of via an event. Your event handler checks if this boolean is set or not. If it is the event handler does nothing and returns. This is one of the biggest annoyances with events or more appropriately the use of C# events while using Windows Forms.