IndexToItemId, ItemIdToIndex

These methods convert between the two numbering schemes for items in list and combo boxes.

Usage

FUNCTION IndexToItemId
LPARAMETERS nIndex
 
FUNCTION ItemIdToIndex
LPARAMETERS nItemId
Each item added to a list or combo has two numbers assigned to it. ItemId is a unique, unchanging number. Index is based on the item's current position in the list, and changes as items are added and removed, and when the Sorted property changes. (See AddItem for a complete explanation of the two numbering systems.)These methods convert between ItemIds and Indexes. They're not needed often, since pretty much everything for handling lists and combos comes in two forms—one for Indexes and one for ItemIds. The only thing we can think of that doesn't offer both approaches is Picture, which uses only the indexes. However, the conversion functions are also handy when the list has mover bars and is based on or related to an array. The functions let you process items in the order they appear, but still connect to your outside arrays based on the ItemID.

Example

* Convert the currently selected index to an item id
nItemId = IndexToItemId( ListIndex )

See Also

AddItem, AddListItem, ComboBox, ListBox, ListIndex, ListItemId, RowSourceType


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .