Article ID: 149182
Article Last Modified on 9/30/2003
Specifies the index of the item most recently added to a ComboBox or ListBox control.
The NewIndex property is especially useful when adding items to a sorted list.
THIS.Sorted = .T. && you can try it with Sorted either .T. or .F.
SET STEP ON && to bring up the Trace window, allow stepping.
THIS.AddItem('AAA') && Adds 'AAA' to the list
THIS.AddItem('BBB') && Adds 'BBB' to the list
THIS.AddItem('CCC') && Adds 'CCC' to the list
THIS.AddItem('ABC') && If Sorted = .T., it should insert 'ABC' into
* the list between item 'AAA' and item 'BBB' and
* NewIndex should be 2.
* If Sorted = .F., it should append 'ABC' to
* the list and NewIndex should be 4.
THIS.AddItem('DDD') && Adds 'DDD' to the list
THIS.AddItem('EEE') && Adds 'EEE' to the list
THISFORM.Combo1.AddItem('BCD')
* If Sorted = .T, it should insert 'BCD' into the list between item
* 'BBB' and item 'CCC'. NewIndex should be 4.
? THISFORM.Combo1.ItemIdtoIndex(THISFORM.combo1.NewItemID)
THISFORM.Combo1.NewIndex _SCREEN.ActiveForm.Combo1.NewIndex
Additional query words: VFoxWin
Keywords: KB149182