This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /api/csharp/editors/pdf/formfields/pdf-list-box-field.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. PdfListBoxField

Represents a list box form field in a PDF document. List boxes display a scrollable list of options for selection.

using Nutrient;

Inherits from: PdfFormField

The SDK creates this class through factory methods or other SDK objects.

Properties

HasSelection

public bool HasSelection { get; }

Whether the list box has a value selected.

Type: bool

ItemCount

public int ItemCount { get; }

The number of items in the list box.

Type: int

SelectedValue

public string SelectedValue { get; set; }

The currently selected value. For multi-select list boxes, this returns the first selected value.

Type: string

Methods

AddItem

public void AddItem(string text)

Adds an item to the list box.

Parameters

NameTypeDescription
textstringThe display text for the item.

Throws: NutrientException - Thrown when the operation fails.

public void AddItem(string text, string value)

Adds an item to the list box with a separate export value.

Parameters

NameTypeDescription
textstringThe display text for the item.
valuestringThe export value for the item.

Throws: NutrientException - Thrown when the operation fails.

RemoveItemAt

public void RemoveItemAt(int index)

Removes an item from the list box at the specified index.

Parameters

NameTypeDescription
indexintThe 0-based index of the item to remove.

Throws: NutrientException - Thrown when index is out of range.

Throws: NutrientException - Thrown when the operation fails.

Resource management

public void Dispose()

PdfListBoxField implements IDisposable. Call Dispose() or use a C# using declaration to release its native handle right away. If you don’t, the handle is released when the object is garbage collected.