DOCERR: ListItemId Doesn't Return -1 as Stated in Online HelpLast reviewed: July 1, 1996Article ID: Q153117 |
The information in this article applies to:
SYMPTOMSIf a user types a value in a ComboBox, and that value is not in the list of items in the ComboBox, the ListItemId property does not return values as expected. In the Online Help and the Visual FoxPro Language Reference, it states that:
"-1 Indicates no items selected. For a ComboBox, it means that user has entered a value not in the list."This is incorrect. If the ComboBox is populated by values, entering an item not in the list causes ListItemId to return a value of 0. If the ComboBox is populated by an array or from a table, entering a value not in the list causes ListItemId to return a 1.
WORKAROUNDIf the ComboBox is populated by values, then a ListItemId of 0 indicates the user has entered a value not in the list. Simply use this instead of the value stated in the Online Help. If the ComboBox is populated by an array or from a table, the following code can be used to determine if an item from the list was selected:
ALLTRIM(ComboBox.DisplayValue)=Alltrim(ComboBox.Value)If these two do not equal each other, then the item the user typed in is not in the list. The left side of the expression will show "" and the right side of the expression will contain the text entered.
MORE INFORMATION
Steps to Reproduce Behavior
|
Additional reference words: 3.00 3.00b VFoxWin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |