Information générale
Catégorie:
Gestionnaire d'écran & Écrans
thisform.mycombobox1.Selected(1)=.t.
thisform.mycombobox1.Setfocus
I assume that you are trying to do this in the init() of the form. That will not work and it is documented in the KB:
PSS ID Number: 161730
Article Last Modified on 10/16/2002
--------------------------------------------------------------------------------
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
BTW, their resolution is a crappy one. If you set foxus to the listbox before setting .selected( 1 ) = .T., your code would work, but a better solution is to set the listbox's ListIndex to 1.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement