LoadingEventArgs.SetDefaultView Method (ViewInfo)

Sets the default view of the form by specifying a ViewInfo object.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

Parameters

view

A ViewInfo object that specifies the view.

Exception typeCondition

ArgumentNullException

The parameter passed to this method is null.

ArgumentException

The parameter passed to this method isnot valid. For example, it is of the wrong type or format.

This type or member can be accessed from code running in forms opened in Microsoft Office InfoPath 2007 or in a Web browser.

In the following example, the SetDefaultView(Microsoft.Office.InfoPath.ViewInfo) method is used in the Loading event handler to set the default view to the second view in the ViewInfoCollection.

public void FormEvents_Loading(object sender, LoadingEventArgs e)
{
   e.SetDefaultView(ViewInfos[1]);
}

Community Additions

Show: