User Controls
The Designer offers a method by which controls along with their properties and event code can be added to a User toolbox panel. A user may create an object customize it by setting properties or writing event code and then save it for use on other forms. When the control is saved, a name and description is provided. Once created, the user control is placed on other forms using the standard object drawing techniques.
Cut and Paste offers a similar functionality but requires opening of the original file, selecting the object, copying the object, closing the original form, and finally pasting the object onto the new form. With a User Control, the object is always available during the screen design process and is simply drawn or dropped onto the new form.
If the object created has child items as in the case of a panel that contains other objects, all the child objects are included in the operation.
Since both the copy/paste mechanism and the user control capability both only include code for event routines, any service routines to be included with the user control should be implemented as a User Event.
See Also: Save as User Control
![]() |