FIX: Multi-Select List Box Does Not Retain Selected Items (134245)
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 Q134245 SYMPTOMS
A List Box that has the Multi-Select property set to True does not always
retain the selected items.
WORKAROUND
Listed below are two workarounds:
- Create a mover-type list box to move the items from one list to another.
-or-
- Populate the list box using the AddItem method, and set
the RowSourceType to None, instead of basing the list box on fields.
For more information about the behavior of list boxes when set to None,
please see the following article in the Microsoft Knowledge Base:
136588 PRB: List Boxes and Combo Boxes Lose Item Properties
Steps Populate the List Box Using AddItem Method
The following steps can be used to fix the sample listed later in this
article, under the "Steps to Reproduce Problem" section, assuming that the
customer table from Testdata.dbc has first been added to the data
environment.
- Change the following properties of the list box:
RowSourceType=none - 1
RowSource=(empty)
- Place the following in the Init Method of the list box:
SCAN
THIS.ADDITEM(cust_id, RECNO(), 1)
THIS.LIST(RECNO(), 2)=address
ENDSCAN
- In the RightClick Method of the list box add the following:
FOR i= 1 to THIS.LISTCOUNT
IF THIS.SELECTED(i)
? THIS.LIST(i)
ENDIF
ENDFOR
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. This problem has been fixed in
Visual FoxPro 5.0 for Windows.
Modification Type: | Major | Last Reviewed: | 9/30/2003 |
---|
Keywords: | kbBug kbfix kbvfp500fix KB134245 |
---|
|