_XDocument4.GetDataVariable(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public:
System::String ^ GetDataVariable(int lVariableNumber);
public string GetDataVariable (int lVariableNumber);
abstract member GetDataVariable : int -> string
Public Function GetDataVariable (lVariableNumber As Integer) As String
Parameters
- lVariableNumber
- Int32
The number of the variable.
Returns
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
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.<span class="label">GetDataVariable</span>(1);
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.<span class="label">GetDataVariable</span>(1);
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(Int32, String) 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.