View Property

Microsoft Office InfoPath

A read-only property that returns a reference to the View object associated with a Microsoft Office InfoPath 2003 form.

expression.View

expression    Required. An expression that returns a reference to an XDocument object.

Security Level

2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Remarks

The View object that the View property accesses represents the view that is currently active in an InfoPath form. After you have set a reference to the View object, you can access any of its properties and methods to programmatically interact with the view.

Example

In the following example, the View property of the XDocument object is used to set a reference to the View object; then, using the Name property of the View object, it displays the name of the view in a message box:

var objView;

objView = XDocument.View;
XDocument.UI.Alert("View name: " + objView.Name);