Share via


ListField Object

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.


Aa156208.parchild(en-us,office.10).gifListField

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.

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 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 contains no lists."
    End If
End Sub