_XDocument3.SetDataVariable method (Int32, String)
Sets the value of 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
Sub SetDataVariable ( _
lVariableNumber As Integer, _
bstrVariableValue As String _
)
'Usage
Dim instance As _XDocument3
Dim lVariableNumber As Integer
Dim bstrVariableValue As String
instance.SetDataVariable(lVariableNumber, _
bstrVariableValue)
void SetDataVariable(
int lVariableNumber,
string bstrVariableValue
)
Parameters
lVariableNumber
Type: System.Int32The number of the variable.
bstrVariableValue
Type: System.StringThe value of the variable.
Implements
_XDocument2.SetDataVariable(Int32, String)
Remarks
If the variable being set is not a valid processing instruction attribute, the SetDataVariable method will return an error.
To get the value of a variable, use the GetDataVariable method.
Note
Microsoft Office 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 SetDataVariable method of the XDocument object is used to set the value of the first variable:
thisXDocument.SetDataVariable(1, "View 2");