DOCERR: NewIndex Property of Lists Doesn't Work as DocumentedID: Q149182 3.00 3.00b WINDOWS kbref kbdocerr The information in this article applies to:
SUMMARYThe Help file describes the NewIndex property of the ListBox and ComboBox controls thus:
Then, later in the same topic, it continues:
The NewIndex property does not work this way when new items are added to a
sorted list. If a list is not sorted, the property simply returns the
number of the last item in the list because it will always be the index of
the last item added.
MORE INFORMATIONIf you need to use a sorted list, you can use the ItemIdtoIndex with in conjunction with the NewItemID property, which does work as expected. According to Help, if you add an item to a sorted list or combo box, NewIndex returns the number of the most recently added item. But this is not the case. Instead, it returns the number of the last item in the list, regardless of whether the list is sorted or not.
Steps to Reproduce Behavior1. Create a new form, and place a combo box on the form. 2. Type the following in the Init event of the combo box:
3. Place a command button on the form, and place the following code in its
3. On the Program menu, click Debug, and enter the following lines into
4. Run the form, and use the Step menu item in the Trace window to step
5. Click the button on the form. Notice that the value displayed on the
NOTE: If you have THIS.Sorted set to true (.T.), NewIndex does not so
indicate when item 'ABC' is inserted into position 2 of the list.
Additional reference words: 3.00 3.00b VFoxWin KBCategory: kbref kbdocerr KBSubcategory: FxotherDochelp
|
Last Reviewed: April 6, 1996 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |