Share via


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)

Syntax

'Declaration
'Usage

Parameters

  • view
    A ViewInfo object that specifies the view.

Exceptions

Exception type Condition

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.

Remarks

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

Example

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]);
}
Public Sub FormEvents_Loading(ByVal sender As Object, _
   ByVal e As LoadingEventArgs)
   e.SetDefaultView(ViewInfos(1))
End Sub

See Also

Reference

LoadingEventArgs Class
LoadingEventArgs Members
Microsoft.Office.InfoPath Namespace