if (eventservice == null) { MessageBox.Show("IEventBindingService is null."); return; }
EventDescriptorCollection edc = TypeDescriptor.GetEvents(component); if (edc == null || edc.Count == 0) { MessageBox.Show("EventDescriptorCollection is null or empty."); return; }
EventDescriptor ed = null; foreach (EventDescriptor edi in edc) if (edi.Name == EventName) { ed = edi; break; } if (ed == null) { MessageBox.Show(string.Format("Search for an event named \"{0}\" failed.", EventName)); return; }
PropertyDescriptor pd = eventservice.GetEventProperty(ed); if (pd == null) { MessageBox.Show("PropertyDescriptor is null."); return; }