XDocuments2.NewFromSolution method (Object)
Creates a new Microsoft Office InfoPath form based on the specified form template.
Namespace: Microsoft.Office.Interop.InfoPath
Assembly: Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)
Syntax
'Declaration
Function NewFromSolution ( _
varURI As Object _
) As XDocument
'Usage
Dim instance As XDocuments2
Dim varURI As Object
Dim returnValue As XDocument
returnValue = instance.NewFromSolution(varURI)
XDocument NewFromSolution(
Object varURI
)
Parameters
varURI
Type: System.ObjectSpecifies the Uniform Resource Identifier (URI) of a form.
Return value
Type: Microsoft.Office.Interop.InfoPath.XDocument
An _XDocument object.
Implements
XDocuments.NewFromSolution(Object)
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 method.
When you use the NewFromSolution method, the new form opens in InfoPath and is ready to be filled out.
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. NewFromSolution (@"C:\MyForm.xsn");