_XDocument2.GetDataVariable method (Int32)

Gets the value of the specified variable, which is a predefined variable stored as a processing instruction attribute in the form's underlying XML document.

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

Syntax

'Declaration
Function GetDataVariable ( _
    lVariableNumber As Integer _
) As String
'Usage
Dim instance As _XDocument2
Dim lVariableNumber As Integer
Dim returnValue As String

returnValue = instance.GetDataVariable(lVariableNumber)
string GetDataVariable(
    int lVariableNumber
)

Parameters

  • lVariableNumber
    Type: System.Int32

    The number of the variable.

Return value

Type: System.String
The value of the specified variable, which is a predefined variable stored as a processing instruction attribute in the form's underlying XML document.

Implements

_XDocument.GetDataVariable(Int32)

Remarks

If the variable is not defined or is empty, the GetDataVariable method will return an empty string. To set a variable, use the SetDataVariable method.

Note

InfoPath only supports using the initialView variable, which is the variable used to specify the initial view displayed when a form is opened. The number of this variable is always 1, and its value must be the name of a view within the form.

Important

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.

Examples

In the following example, the GetDataVariable method of the XDocument object is used to return the value of the first variable:

string variable1;
variable1= thisXDocument.GetDataVariable(1);

See also

Reference

_XDocument2 interface

_XDocument2 members

GetDataVariable overload

Microsoft.Office.Interop.InfoPath.SemiTrust namespace