LoadingEventArgs.SetDefaultView method (String)

Office 2013 and later

Sets the default view of the form by specifying the name of the view.

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

'Declaration
Public MustOverride Sub SetDefaultView ( _
	view As String _
)
'Usage
Dim instance As LoadingEventArgs
Dim view As String

instance.SetDefaultView(view)

Parameters

view
Type: System.String

The name of the view.

ExceptionCondition
ArgumentNullException

The parameter passed to this method is a null reference (Nothing in Visual Basic).

ArgumentException

The parameter passed to this method is not 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 InfoPath Filler or in a Web browser.

In the following code example, the SetDefaultView(System.String) method is used in the Loading event handler to set the default view to the view named "View2".

Public Sub FormEvents_Loading(ByVal sender As Object, _
   ByVal e As LoadingEventArgs)
   e.SetDefaultView("View2")
End Sub
Show: