ListFieldInteger |
包含关于由计算机自动创建的域的信息。用户不能创建 ListFieldinteger 对象,而是由 Microsoft FrontPage 用该对象为列表中的每个项目创建 ID。例如,在典型的列表中,ID 域由计算机创建,作为列表中每个项目的唯一标识符。
使用 ListFields.Item(index) 可以返回 ListFieldInteger 对象,其中 index 是域的名称或其在集合中的位置(用数字表示)。下列示例显示当前列表所有 Integer 域的名称。如果站点不包含列表,或者如果列表不包含 Integer 域,则向用户显示一条消息。
Sub ListIntegerFields()
'Displays the name of Integer fields in the current list
Dim objApp As FrontPage.Application
Dim objField As ListField
Dim strType As String
Dim blnFound As Boolean
blnFound = False
Set objApp = FrontPage.Application
If Not ActiveWeb.Lists Is Nothing Then
For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
'Check if it is a computed field of type fpFieldInteger
If objField.Type = fpFieldInteger Then
blnFound = True
If strType = "" Then
'Create new string
strType = objField.Name & vbCr
Else
'Add next field name to string
strType = strType & objField.Name & vbCr
End If
End If
Next objField
If blnFound = True Then
MsgBox "The names of the fields in this list are: " & _
vbCr & strType
Else
MsgBox "There are no Integer fields in the list."
End If
Else
'Otherwise display message to user
MsgBox "The current web contains no lists."
End If
End Sub