BUG: Cannot Set the Selected Item for a List box in Form Init (161730)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
This article was previously published under Q161730 SYMPTOMS
In Visual FoxPro 3.0 the selected item in a list box can be initialized by
placing the following code in the Form Init or the List box Init:
THISFORM.List1.Selected(1) = .T.
This does not work in Visual FoxPro version 5.0.
RESOLUTION
Place the following code in the Activate method of the form. The variable
acts like a switch so that the code is executed only when the form is first
instantiated. The variable switch should be added to the form as a
property. Switch is initialized to false.
IF !THISFORM.switch
THISFORM.List1.Selected(1)= .T.
THISFORM.switch = .T.
ENDIF
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 10/16/2002 |
---|
Keywords: | kbBug kbProgramming KB161730 |
---|
|