IainMacb
asked on
Combobox with an array that gets lengthened
I've got a combobox with the RowSourceType property set to 5, to use an array.
The last row in the array contains an entry "new". Selecting this allows you to add an extra entry into the list.
Except that once I've added the new entry, I lose the "new" entry at the end of the list.
I think that what's happening is that when I first set up the combobox, VFP works out that it has (say) 200 rows. Adding the extra row means that the array now has 201 rows, with "new" in the 201st row. But VFP still thinks that the array has 200 rows.
I've looked through the object's properties using DEBUG, but the only obvious property is .LISTCOUNT, which is read-only.
Is there another property that I should have incremented in some way?
The last row in the array contains an entry "new". Selecting this allows you to add an extra entry into the list.
Except that once I've added the new entry, I lose the "new" entry at the end of the list.
I think that what's happening is that when I first set up the combobox, VFP works out that it has (say) 200 rows. Adding the extra row means that the array now has 201 rows, with "new" in the 201st row. But VFP still thinks that the array has 200 rows.
I've looked through the object's properties using DEBUG, but the only obvious property is .LISTCOUNT, which is read-only.
Is there another property that I should have incremented in some way?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
REQUERY() method does the trick. Excellent!
Otherwise a cursor may be the easier rowsource in that case, new records in a cursor will be reflected in the combobox right away.
Bye, Olaf.