Share via


XmlForm.New Property

Gets a value that specifies whether a form is new.

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

Syntax

'Declaration
Public MustOverride ReadOnly Property New As Boolean
    Get
'Usage
Dim instance As XmlForm
Dim value As Boolean

value = instance.New
public abstract bool New { get; }

Property Value

Type: System.Boolean
true if the form is new; otherwise false.

Remarks

The New property behaves differently depending on whether the new form is created in Microsoft InfoPath 2010 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.

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

See Also

Reference

XmlForm Class

XmlForm Members

Microsoft.Office.InfoPath Namespace