DOCERR: ListItemId Doesn't Return -1 as Stated in Online Help (153117)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
This article was previously published under Q153117 SYMPTOMS
If 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.
WORKAROUND
If 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.
Modification Type: | Major | Last Reviewed: | 9/30/2003 |
---|
Keywords: | KB153117 |
---|
|