_XDocument2.SetDataVariable 方法 (Int32, String)
为作为表单基础 XML 文档中的处理指令属性而存储的预定义变量设置值。
命名空间: Microsoft.Office.Interop.InfoPath.SemiTrust
程序集: Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)
语法
声明
Sub SetDataVariable ( _
lVariableNumber As Integer, _
bstrVariableValue As String _
)
用法
Dim instance As _XDocument2
Dim lVariableNumber As Integer
Dim bstrVariableValue As String
instance.SetDataVariable(lVariableNumber, _
bstrVariableValue)
void SetDataVariable(
int lVariableNumber,
string bstrVariableValue
)
参数
lVariableNumber
类型:System.Int32变量数。
bstrVariableValue
类型:System.String变量值。
实现
_XDocument.SetDataVariable(Int32, String)
备注
如果所设置的变量不是有效的处理指令属性,则 SetDataVariable 方法将返回错误。
若要获取变量的值,请使用 GetDataVariable 方法。
备注
只支持使用 initialView 变量,该变量用于指定在表单打开时所显示的初始视图。该变量的数目始终为 1,且变量值必须为表单内某个视图的名称。
重要
此成员只能由与当前打开的表单在相同域中运行的表单访问,或者由已授予跨域权限的表单访问。
示例
在以下示例中,XDocument 对象的 SetDataVariable 方法用于设置第一个变量的值:
thisXDocument.SetDataVariable(1, "View 2");