共用方式為


View.Name 屬性

取得檢視的名稱。

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

語法

'宣告
<DispIdAttribute(1)> _
ReadOnly Property Name As String
'用途
Dim instance As View
Dim value As String

value = instance.Name
[DispIdAttribute(1)] 
string Name { get; }

備註

若要判斷預設檢視,請使用 ViewInfoObject 物件的 IsDefault 屬性。

範例

在下列範例中,ViewObject 物件的 Name 屬性是用於判斷使用者所切換至的檢視。如果該檢視是 "Archive Customer" 檢視,則會在表單的基礎 XML 文件加入附註值:

if (thisXDocument.View.Name == @"Archive Customer")
{
 IXMLDOMNode notes = thisXDocument.DOM.selectSingleNode(@"/Customers/CustomerInfo/Notes");
 IXMLDOMNode div = thisXDocument.DOM.createNode(1, "div", @"http://www.w3.org/1999/xhtml");

 div.text = "Note recorded " + thisXDocument.Util.Date.Now().ToString();
 notes.appendChild(div);
}

請參閱

參考

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