|InfoPath Developer Reference|
Represents a control present in the view.
Version Added: InfoPath 2007
The IInfoPathViewControl interface, used in conjunction with the IInfoPathDataImporter interface, allows developers to get specific information about the controls in the view, such as the ControlType and the DataType, the Top and Left positions, the XML NodeName associated with the control, the and the InputScope. The Value property is the only property that can be set.
For a list of controls that are enumerated if present in the view, see the GetControls method of the IInfoPathDataImporterFields interface. For a list of acceptable data types that can be used with specific controls, see the Value property of the IInfoPathViewControl interface.
This object or member is used for extending the InfoPath application and is not intended to be used directly from your form code.
For more information about programmatically importing data into an InfoPath form, see the InfoPath Developer Portal on the Microsoft Office Developer Center.
In the following example, the Import method of the IInfoPathDataImporter interface is used to iterate through the mshtml.IEnumUnknown collection of IInfoPathViewControl controls in the view of the active form.
The Import routine is the main part of a solution used to build a custom data importer. The Visual Studio project requires a reference to the Microsoft Office InfoPath 2.0 Type Library and System.Windows.Forms, with Imports statements for each as well as mshtml. Implements statements are required to generate the signatures for the methods provided by the custom data importer interfaces, including IInfoPathDataImporter, IInfoPathDataImporterFields, IInfoPathViewControl, and IPropertyBag.
|To build a custom data importer using a .NET class library, check the Register for COM interop check box on the Compile tab of the class properties editor.|
|To debug a custom data importer, set a Start Action in Visual Studio to Start an external program, and browse to INFOPATH.EXE located at <drive>:\Program Files\Microsoft Office\Office12\. This option is available on the Debug tab of the class properties editor.|