CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2009
    Posts
    1

    Collection Editor -> Remove Button Event

    Hello,
    I have some problems with the Collection Editor. I have to do some synchronizations after removing an item from the collection but can;t figure out which function I have to override.

    For the "add" button works everything fine with this function:

    Code:
    public class myEditor : CollectionEditor
    	{
    	protected override object CreateInstance(Type itemType)
    			{
    				if (!form.IsDisposed && form.ShowDialog() == DialogResult.OK)
    				{
    					// [... do some stuff here ..]
    				}
    				else
    				{
    					return null;
    				}
    			}
    	}
    Now I'm searching for the function of the remove button.
    Thanks in advance!

  2. #2
    Join Date
    Jul 2011
    Posts
    1

    Re: Collection Editor -> Remove Button Event

    I use a different approach. I hook an event to the Remove Button as bellow:

    protected override CollectionForm CreateCollectionForm()
    {
    if (frmCollectionEditorForm.Controls[0] is TableLayoutPanel)
    {
    TableLayoutPanel tlp = frmCollectionEditorForm.Controls[0] as TableLayoutPanel;

    if (tlp.Controls[1] is TableLayoutPanel)
    {
    TableLayoutPanel tlp2 = tlp.Controls[1] as TableLayoutPanel;

    if (tlp2.Controls[1] is Button)
    (tlp2.Controls[1] as Button).Click += Remove_Click;
    }
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured