Active Query Builder 2 .NET Edition reference
ControlDestroying Event
Example 



Invoked before the control is destroyed inside the component.
Syntax
'Declaration
 
Public Event ControlDestroying As ControlDestroyingEventHandler
'Usage
 
Dim instance As QueryBuilder
Dim handler As ControlDestroyingEventHandler
 
AddHandler instance.ControlDestroying, handler
public event ControlDestroyingEventHandler ControlDestroying
public: __event ControlDestroyingEventHandler* ControlDestroying
Remarks
Use this event to free resources and unbound events created in the ControlCreated Event
Example
Removes button at the top of each sub-query DataSource control created in the ControlCreated event handler.
private void queryBuilder1_ControlDestroying(ControlOwner owner, Control control)
{
    if (owner is DataSourceQuery && control is DataSourceControl)
    {
        DataSourceControl dataSourceControl = (DataSourceControl) control;
 
        foreach (Control c in dataSourceControl.Controls)
        {
            if (c is Button)
            {
                // remove event handler to avoid memory leak
                c.Click -= customButton_Click;
                break;
            }
        }
    }
}
See Also

Reference

QueryBuilder Class
QueryBuilder Members

 

 


© Copyright 2005-2012 ActiveDBSoft. All rights reserved.

Send Feedback