Share via


ListFieldChoice Object

ListFieldChoice
Web

Contains information about the choice field. The choice field allows the user to select from a specified number of options by providing a drop-down list or radio buttons in the list.

Using the ListFieldChoice object

Use ListFields.Item(index), where index is the name or ordinal position of a field of type fpFieldChoice to return a single ListFieldChoice object.

Use the ListFields.Add method to add a field of type fpFieldChoice to the ListFields collection. The following example adds a new field named NewChoiceField of type fpFieldChoice, to the ListFields collection. Use the AddChoice method to add choices to the list. Use the ClearChoices method to clear the choices from the list.

Sub DisplayChoice()
'Display choice

    Dim objApp As FrontPage.Application
    Dim objLstFlds As listFields
    Dim objFldChoice As ListFieldChoice
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "NewChoiceField"
    'Add new field of type fpFieldChoice to list
    objLstFlds.Add Name:=strName, Description:="New Choice value Field", _
                   Fieldtype:=fpFieldChoice, Required:=True

    MsgBox "A new Field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & "."

End Sub

Properties | AllowFillInChoices Property | Application Property | Choices Property | DefaultValue Property | Description Property | DisplayFormat Property | Name Property | Parent Property | ReadOnly Property | Required Property | Type Property | Web Property

Methods | AddChoice Method | ClearChoices Method | ConvertToField Method | Delete Method | Move Method | RemoveChoice Method | SetChoices Method

Parent Objects

Child Objects | Web Object