ContentControlListEntry Object
Word Developer Reference |
A ContentControlListEntry object represents a list item in a drop-down list or combo box content control. A ContentControlListEntry object is a member of the ContentControlListEntries collection for a ContentControl object.
Remarks
Use the Add method of the ContentControlListEntries collection to create a new ContentControlListEntry object. Use the Item method, or DropdownListEntries(Index), where Index is the ordinal position of the content control list item, to access an individual list item within the ContentControlListEntries collection.
Note |
---|
List entries must have unique display names. Attempting to add a list item that already exists raises a run-time error. |
The following example uses the Add method to add several list items to a new drop-down list content control, and then uses the Item method to access the third item in the list and change the display text.
Visual Basic for Applications |
---|
|
Use the MoveUp and MoveDown methods to reposition items in a drop-down list. The following example moves the first item down, so that it becomes the last item in the list, and moves the last item up, so that it becomes the first item in the list.
Visual Basic for Applications |
---|
|
Use the Select method to programmatically select a content control list item. The following example inserts a drop-down list content control into the active document, sets the title and placeholder text and adds several items to the list, and then selects the last item entered.
Visual Basic for Applications |
---|
|
Use the Text property to set the display text for a content control list item, and use the Value property to set a programmatic value that you may use later for processing a form. For example, you may use a content control drop-down list for a list of products. The Text property may contain the name of the product, a display name that a user can easily recognize and understand. The Value property may contain the product number for the product that corresponds to a product number in a database. You can then use the the product number from the Value property to look up product information in a database. Also, the value of the Value property is what is sent to the custom XML data if the content control is mapped to XML data in the data store.
The following example sets the value for the item based on the contents of the display text.
Visual Basic for Applications |
---|
|
Use the Delete method to remove an item from a content control drop-down list or combo box. The following example deletes a drop-down list item if the display text of the item is "Other".
Visual Basic for Applications |
---|
|
See Also