Microsoft KB Archive/177340

= BUG: Using Selected Method in Init Event Does Not Work =

Article ID: 177340

Article Last Modified on 12/11/1999

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q177340



SYMPTOMS
In Visual FoxPro versions 5.x, programmatically using the Selected method to select an item in a list box does not work in the Init method of a list box or a form.



RESOLUTION
Use the following method to programmatically select an item in the Init method of a list box or a form: Thisform.List1.DisplayValue = Thisform.List1.List(1) && This will select

&& the first item.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
This problem does not occur in Visual FoxPro versions 3.x.

Steps to Reproduce Behavior
 Create a form and named it MyList.  Place a list box object on the form and set the following properties: RowSourceType = 1 - Value RowSource = "One, Two, Three, Four, Five" (without the quotations)   In the Init method of the form, type the following code: Thisform.List1.Selected(1)=.T. && Select the first item.  Save and run the form.

NOTE: When the form runs, no item is selected in the list box.

Additional query words: Listbox Selected kbvfp500 kbvfp600

Keywords: kbbug KB177340

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.