EN
Konten ini tidak tersedia dalam bahasa Anda dan berikut adalah versi bahasa Inggris.

View class

Represents a view within a form.

System.Object
  Microsoft.Office.InfoPath.View

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

public abstract class View

The View class provides 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.

NoteNote

The InfoPath object model does not provide a collection of View objects, but it does provide the ViewInfoCollection class which provides a collection of ViewInfo objects, each of which provides information about the corresponding view it represents. Additionally, the View class provides the ViewInfo property, which allows you to access information about the associated view.

The View object that represents the current view is accessed using the CurrentView property of the XmlForm class. In the following example, first a View object is created to reference the form's currently active view. Then, the ViewInfo property is used to access the ViewInfo object for the view and display its name in a message box.

// Set a reference to the current view.
View thisView = this.CurrentView;

// Display the view's name.
MessageBox.Show(thisView.ViewInfo.Name);

To change the currently active view, use the SwitchView method of the ViewInfoCollection class as shown in the following example.

this.ViewInfos.SwitchView("View2");

To force an update of a view to display information that has been programmatically changed in the form's underlying XML document, you can use the ForceUpdate method of the View class, as shown in the following example.

this.CurrentView.ForceUpdate();
Me.CurrentView.ForceUpdate()

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Konten Komunitas

Tampilkan:
© 2014 Microsoft