Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
These methods convert between the two numbering schemes for items in list and combo boxes.
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.
* Convert the currently selected index to an item id
nItemId = IndexToItemId( ListIndex )
AddItem, AddListItem, ComboBox, ListBox, ListIndex, ListItemId, RowSourceType