Partilhar via


Developing a User Interface for a Custom ForEach Enumerator

After you have overridden the implementation of the properties and methods of the base class to provide your custom functionality, you may want to create a custom user interface for your connection manager. If you do not create a custom user interface, users can only configure the new custom Foreach enumerator by using the Properties window.

In a custom user interface project or assembly, you create a class that implements ForEachEnumeratorUI. This class derives from System.Windows.Forms.UserControl, which is typically used to create a composite control to host other Windows Forms controls. The control that you create is displayed in the Enumerator configuration area of the Collection tab of the Foreach Loop Editor.

Important

After signing and building your custom user interface and installing it in the global assembly cache as described in Building, Deploying, and Debugging Custom Objects, remember to provide the fully qualified name of this class in the UITypeName property of the DtsForEachEnumeratorAttribute.

For a working sample of a custom enumerator, see ForEachDirectory Sample.

Coding the User Interface Control Class

Initializing the User Interface

Override the Initialize method to cache references to the host object and to the collections of connection managers and variables defined in the package. The host object exposes the custom enumerator through its InnerObject property.

Setting Properties on the User Interface Control

Since the UserControl class is intended for use as a composite control to host other Windows Forms controls, you can design your custom user interface by dragging and dropping controls, arranging them, setting their properties, and responding at run time to their events as in any Windows Forms application.

Saving Settings

Override the SaveSettings method to copy the values selected by the user from the controls to the properties of the enumerator when the user closes the editor.

See Also

Tasks

Creating a Custom Foreach Enumerator
Coding a Custom Foreach Enumerator

Help and Information

Getting SQL Server 2005 Assistance