共用方式為


_XDocument3.GetDataVariable 方法

取得指定的變數值,它是預先定義的變數,而且儲存為表單基礎 XML 文件中的處理指示屬性。

**命名空間:**Microsoft.Office.Interop.InfoPath
**組件:**Microsoft.Office.Interop.InfoPath (於 microsoft.office.interop.infopath.dll 中)

語法

'宣告
<DispIdAttribute(22)> _
Function GetDataVariable ( _
    <InAttribute> lVariableNumber As Integer _
) As String
'用途
Dim instance As _XDocument3
Dim lVariableNumber As Integer
Dim returnValue As String

returnValue = instance.GetDataVariable(lVariableNumber)
[DispIdAttribute(22)] 
string GetDataVariable (
    [InAttribute] int lVariableNumber
)

參數

  • lVariableNumber
    變數數字。

傳回值

指定的變數值,這是預先定義的變數,而且儲存為表單基礎 XML 文件中的處理指示屬性。

備註

如果變數未定義或為空值,GetDataVariable 方法將傳回空字串。若要設定變數,請使用 SetDataVariable 方法。

注意

InfoPath 僅支援使用 initialView 變數,即用來在開啟表單時指定顯示初始檢視的變數。此變數的數目永遠為 1,且其值必須是表單中檢視的名稱。

範例

在下列範例中,XDocument 物件的 GetDataVariable 方法是用於傳回第一個變數的值:

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

請參閱

參考

_XDocument3 介面
_XDocument3 成員
Microsoft.Office.Interop.InfoPath 命名空間