InitializeEventArgs Class

Used to set InputParameters of an InfoPath form template hosted in the XmlFormView control.

Inheritance Hierarchy

System.Object
  System.EventArgs
    Microsoft.Office.InfoPath.Server.Controls.InitializeEventArgs

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

Syntax

'Declaration
Public NotInheritable Class InitializeEventArgs _
    Inherits EventArgs
'Usage
Dim instance As InitializeEventArgs
public sealed class InitializeEventArgs : EventArgs

Remarks

For more information about using query and input parameters, see How to: Use Query Parameters to Invoke Browser-Enabled InfoPath Forms.

Examples

In the following example, the InputParameters property is used in the Initialize event of the XmlFormView control to create a name/value pair indicating the department name.

[Visual Basic]

Protected Sub XmlFormView1_Initialize(ByVal sender As Object, ByVal e As Microsoft.Office.InfoPath.Server.Controls.InitializeEventArgs) Handles XmlFormView1.Initialize
    e.InputParameters("Dept") = "Accounting"
End Sub

To use this input parameter in form code, use the InputParameters() property of the LoadingEventArgs object available in the Microsoft.Office.InfoPath namespace. For example, the value set in the XmlFormView1 initialization event is used to set a field's value in the form.

Public Sub FormEvents_Loading(ByVal sender As Object, ByVal e As LoadingEventArgs)
    Dim MyNav As XPathNavigator
    MyNav = Me.MainDataSource.CreateNavigator()
    MyNav.SelectSingleNode("/my:myFields/my:field2", Me.NamespaceManager).SetValue(e.InputParameters("Dept").ToString())
End Sub

[C#]

protected void XmlFormView1_Initialize(object sender, InitializeEventArgs e)
{
    e.InputParameters["Dept"] = "Accounting";
}

To use this input parameter in form code, use the InputParameters() property of the LoadingEventArgs object available in the Microsoft.Office.InfoPath namespace. For example, the value set in the XmlFormView1 initialization event is used to set a field's value in the form.

public void FormEvents_Loading(object sender, LoadingEventArgs e)
{
    XPathNavigator myNav = this.MainDataSource.CreateNavigator();
    myNav.SelectSingleNode("/my:myFields/my:field2", this.NamespaceManager).SetValue(e.InputParameters["Dept"].ToString());
}

Thread Safety

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

See Also

Reference

InitializeEventArgs Members

Microsoft.Office.InfoPath.Server.Controls Namespace