We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Collection Editor Remove Event

Thread ID:




1420 Oct 26,2002 05:58 PM Windows Forms 0
Tags: FAQ
Asked On October 26, 2002 05:58 PM

Hi, I have a control with a collection derived from the EventCollection below. When I add an item to the derived collection using the collection editor the Inserted event is raised - good so far. The problem is that when I remove an item with the collection editor the Removed event does not get raised. Any ideas? Steven. // Declare the event signatures public delegate void EventCollectionClearHandler(); public delegate void EventCollectionChangeHandler(int index, object value); public class EventCollection : CollectionBase { // Collection change events public event EventCollectionClearHandler Clearing; public event EventCollectionClearHandler Cleared; public event EventCollectionChangeHandler Inserting; public event EventCollectionChangeHandler Inserted; public event EventCollectionChangeHandler Removing; public event EventCollectionChangeHandler Removed; protected EventCollection() { } // Overrides for generating events protected override void OnClear() { // Any attached event handlers? if (Clearing != null) Clearing(); } protected override void OnClearComplete() { // Any attached event handlers? if (Cleared != null) Cleared(); } protected override void OnInsert(int index, object value) { // Any attached event handlers? if (Inserting != null) Inserting(index, value); } protected override void OnInsertComplete(int index, object value) { // Any attached event handlers? if (Inserted != null) Inserted(index, value); } protected override void OnRemove(int index, object value) { // Any attached event handlers? if (Removing != null) Removing(index, value); } protected override void OnRemoveComplete(int index, object value) { // Any attached event handlers? if (Removed != null) Removed(index, value); } protected int IndexOf(object value) { // Find the 0 based index of the requested entry return base.List.IndexOf(value); } }


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.