// I understand this. It's the event declaration public event EventHandler MyFooBar; // I get this if (this.MyTextBox.Text == "FOO") // I looked up the EventArgs class on MSDN. It states: // // "This class contains no event data; it is used by events that do not pass state // information to an event handler when an event is raised. If the event handler // requires state information, the application must derive a class from this class // to hold the data." // // So this creates and passes a default EventArgs class because OnMyFooBar // takes an EventArgs parameter, correct? this.OnMyFooBar(new EventArgs()); // Lastly, this raises the MyFooBar event: protected virtual void OnMyFooBar(EventArgs e) { // This is don't get at all. MyFooBar is an event definition. How can it be Null? // What would make it not null? if MyFooBar != null) MyFooBar(this, e); }This I need help with:
// Can you translate this into english for me? this.oMyControl.MyFooBar += new System.EventHandler(this.oMyControl_MyFooBarHandler); // This is the function to run when the event is raised, correct? private void oMyControl_MyFooBarHandler(object sender, System.EventArgs e) { // whatever your code needs to be }