ListField Object

Microsoft FrontPage Visual Basic

ListField Object

Multiple objects ListFields
ListField
Web

Contains information about the fields that make up a List object. The fields of a list define the columns that appear in the list and present information about the items in the list. The ListField object is a base class that defines the common members used by the different types of fields in Microsoft FrontPage lists.

This object is supported only by Web pages or sites that are based on Microsoft SharePoint Services.

Using the ListField object

Use ListFields.Item(index), where index is the either name of the field or it's position within the collection to return a single ListField object. The following example displays the names of all fields in the current list. If the Web site contains no lists, a message is displayed to the user.

Sub ListAllFields()
'Displays the name of fields in the current list

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String

    Set objApp = FrontPage.Application

    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            If strType = "" Then
                'Create new string
                strType = objField.Name & vbCr
            Else
                'Add next field name to string
                strType = strType & objField.Name & vbCr
            End If
        Next objField
        MsgBox "The names of the fields in this list are: " & _
                vbCr & strType
    Else
        'Otherwise display message to user
        MsgBox "The current web site contains no lists."
    End If
End Sub