Share via


View Object

View

Represents a view within a Microsoft Office InfoPath 2003 form. The View object provides a number of properties and methods that can be used to programmatically interact with an InfoPath view, including methods for selecting data contained in the view, switching from one view to another, synchronizing the view with a form's underlying XML document, and executing an InfoPath editing action.

Remarks

InfoPath forms can contain one or more views, and one view is always defined as the default view. When you work with a view using the View object, you are accessing the currently active view.

Note  The InfoPath object model also provides the ViewInfos collection, which can be used to get information about all of the views implemented in a form.

Using the View object

The View object is accessed through the View property of the XDocument object. For example, the following code sets a reference to a form's currently active view:

var objView;

objView = XDocument.View;

To change the currently active view, you can use the SwitchView method of the View object as follows:

XDocument.View.SwitchView("View2");

To force an update of a view based on changes in a form's underlying XML document, you can use the ForceUpdate method of the View object, as shown here:

XDocument.View.ForceUpdate();

For more information about using the View object, see Working with views.

Properties | Name Property (View Object) | Window Property (View Object)

Methods | DisableAutoUpdate Method | EnableAutoUpdate Method | ExecuteAction Method | Export Method | ForceUpdate Method | GetContextNodes Method | GetSelectedNodes Method | SelectNodes Method | SelectText Method | SwitchView Method