Delphi / Object Pascal · Exception

EStringListError Exception

What does EStringListError Exception mean in Delphi / Object Pascal?

Raised when a list box control (TCustomListBox and descendants) is accessed with an item index that isn't valid for the current item count - typically after the list was cleared, filtered, or repopulated but stale cached index is reused.

EStringListError ExceptionDelphi (VCL)

Condition

Raised when a list box control (TCustomListBox and descendants) is accessed with an item index that isn't valid for the current item count - typically after the list was cleared, filtered, or repopulated but stale cached index is reused.

Fix

Re-check ItemIndex/Count after any operation that can change the list contents before using a cached index, and guard indexed access with an explicit range check.

Related exception