ReadOnly Property

Microsoft FrontPage Visual Basic

ReadOnly Property

Returns a Boolean that determines if a specified field has read-only permissions. If True, the field cannot be modified by the user. Read-only.

expression.ReadOnly

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

The following example stores the names and default values of all fields with read-only permissions in the first list of the active Web site. If the active Web site contains no lists, a message is displayed to the user.

    Sub FieldPermissions()
'Displays read/write permissions of all
'fields in the list.

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim objFields As listFields
    Dim strPerms As String

    Set objApp = FrontPage.Application
    Set objFields = objApp.ActiveWeb.Lists.Item(0).Fields

    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objFields
             'If field is read-only, add to list
             If objField.ReadOnly = True Then
                If strPerms = "" Then
                    'if first value in string
                    strPerms = objField.Name & "  -  " & _
                    objField.DefaultValue & vbCr
                Else
                    'add value to string
                    strType = strPerms & objField.Name & "  -  " & _
                    objField.DefaultValue & vbCr
                End If
             End If
        Next objField
    Else
        'display message to user
        MsgBox "The active Web site contains no lists."
    End If
End Sub