XDocuments2.NewFromSolution(Object) Method

Definition

Creates a new Microsoft Office InfoPath form based on the specified form template.

public:
 Microsoft::Office::Interop::InfoPath::XDocument ^ NewFromSolution(System::Object ^ varURI);
public Microsoft.Office.Interop.InfoPath.XDocument NewFromSolution (object varURI);
abstract member NewFromSolution : obj -> Microsoft.Office.Interop.InfoPath.XDocument
Public Function NewFromSolution (varURI As Object) As XDocument

Parameters

varURI
Object

Specifies the Uniform Resource Identifier (URI) of a form.

Returns

An _XDocument object.

Implements

Examples

In the following example, the NewFromSolution method of the XDocumentsCollection collection is passed the URI of an existing form template, and a new form is created and its associated _XDocument object returned:

XDocument newDocument;

newDocument = thisApplication.XDocuments. <span class="label">NewFromSolution</span> (@"C:\MyForm.xsn");

Remarks

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

When you use the NewFromSolution method, the new form opens in InfoPath and is ready to be filled out.

Applies to