XmlFormCollection.New Method (String) (Microsoft.Office.InfoPath)

Creates a new form based on the specified form.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

Syntax

'Declaration
Public MustOverride Function New ( _
    formLocation As String _
) As XmlForm
'Usage
Dim instance As XmlFormCollection
Dim formLocation As String
Dim returnValue As XmlForm

returnValue = instance.New(formLocation)
public abstract XmlForm New (
    string formLocation
)

Parameters

  • formLocation
    The Uniform Resource Identifier (URI) of the form on which to base the new form.

Return Value

An XmlForm object that represents the new form that was created.

Exceptions

Exception type Condition

InvalidOperationException

The New method was called from an event handler for the Loading event.

Remarks

The New method can only be used to create a new form based on an existing form; it cannot be used to create a new form based on a form template. To create a form from a form template, use the NewFromFormTemplate method.

When you use the New method, the new form opens in Microsoft Office InfoPath 2007 and is ready to be filled out.

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 only from code running in forms opened in Microsoft Office InfoPath 2007.

Example

In the following example, the New method of the XmlFormCollection class is passed the URI of an existing form on which to base the new form and the new form's associated XmlForm object is returned.

XmlForm newDocument = 
   this.Application.XmlForms.New(@"C:\MyForm.xml");
Dim newDocument As XmlForm  = _
   Me.Application.XmlForms.New("C:\MyForm.xml")

See Also

Reference

XmlFormCollection Class
XmlFormCollection Members
Microsoft.Office.InfoPath Namespace