XmlFormCollection.Open Method (String, XmlFormOpenMode) (Microsoft.Office.InfoPath)

Opens the specified form using the specified open mode behavior.

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

Syntax

'Declaration
Public MustOverride Function Open ( _
    fileLocation As String, _
    behavior As XmlFormOpenMode _
) As XmlForm
'Usage
Dim instance As XmlFormCollection
Dim fileLocation As String
Dim behavior As XmlFormOpenMode
Dim returnValue As XmlForm

returnValue = instance.Open(fileLocation, behavior)
public abstract XmlForm Open (
    string fileLocation,
    XmlFormOpenMode behavior
)

Parameters

  • fileLocation
    The Uniform Resource Identifier (URI) of the form to open.
  • behavior
    An XmlFormOpenMode enumeration that specifies how the form will be opened.

Return Value

An XmlForm object that represents the form that was opened.

Remarks

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

When you use the Open method, the specified 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 Open method of the XmlFormCollection class is passed the URI of the form to open in read-only mode and its associated XmlForm object is returned.

XmlForm document = this.Application.XmlForms.Open(
   @"C:\MyForm.xml", XmlFormOpenMode.ReadOnly);
Dim document As XmlForm = Me.Application.XmlForms.Open(_
   "C:\MyForm.xml", XmlFormOpenMode.ReadOnly)

See Also

Reference

XmlFormCollection Class
XmlFormCollection Members
Microsoft.Office.InfoPath Namespace