_XDocument3.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
Assembly: Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)
Syntax
'Declaration
Function GetDataVariable ( _
lVariableNumber As Integer _
) As String
'Usage
Dim instance As _XDocument3
Dim lVariableNumber As Integer
Dim returnValue As String
returnValue = instance.GetDataVariable(lVariableNumber)
string GetDataVariable(
int lVariableNumber
)
Parameters
lVariableNumber
Type: System.Int32The 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
_XDocument2.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.
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);