Edit

Share via


XmlForm.New Property

Definition

Gets a value that specifies whether a form is new.

public:
 abstract property bool New { bool get(); };
public abstract bool New { get; }
member this.New : bool
Public MustOverride ReadOnly Property New As Boolean

Property Value

true if the form is new; otherwise false.

Examples

The following code example shows a pattern for using the New property to conditionally run code depending on whether the form is new.

if (this.New)
{
   // Code to run if form is new.
}
else
{
   // Code to run if form is not new.
}
If (Me.[New]) Then
   ' Code to run if form is new.
Else
   ' Code to run if form is not new.
End If

Remarks

The New property behaves differently depending on whether the new form is created in Microsoft InfoPath or in a Web browser.

In a Web browser, the New property is set to true when a new form is created. The property is set to false only when an existing form is opened.

In InfoPath, the New property is set to true when a new form is created. The property is set to false as soon as the form is successfully saved. The property is also set to false when an existing form is opened.

Note: The New property is equivalent to the IsNew property of the XDocument object in the COM/Scripting object model, and to the IsNew property of the _XDocument2 interface of the InfoPath 2003 compatible managed code object model.

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

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

Applies to