# Uninit Method

Defines a method that must be provided by the developer to perform any clean up routines that are required before an instance of the control is removed from a view.

expression.Uninit()

expression Required. An expression that returns a reference to the InfoPathControl object.

## Remarks

InfoPath calls the Uninit method immediately before the control is removed from the view and destroyed. Note that because InfoPath forms make use of XSL transforms to represent views, any changes in the data or explicit calls to the object model can cause InfoPath to automatically synchronize the view with the data that is contained in a form's underlying XML document, which destroys and recreates the view. This means that ActiveX controls are likely to be created and destroyed much more often within a given session than controls in Visual Basic forms or Web forms. ActiveX controls which need to preserve state information independent of the bound data, such as the state of the scroll position, should create routines in the Init method of the control that use the SetNamedNodeProperty method to save this information, and use the GetNamedNodeProperty method to restore state information during the Init method call.

The InfoPathControl and InfoPathControlSite objects and their methods and properties are designed to be used only from the implementation of an ActiveX control. These objects and their members are not supported in InfoPath form code. For more information on how to create ActiveX controls that work with InfoPath, see the InfoPath Developer Center.

Note This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Editions Service Pack 1 or later is not installed. Any form template that contains a view with an ActiveX control that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp