Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using thisform in ComboBox.RowSource
Message
De
08/11/2013 14:50:12
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
 
 
À
08/11/2013 13:59:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP3
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01587572
Message ID:
01587576
Vues:
75
>I want to use:
>SELECT * FROM MyTable WHERE MyField = thisform.MyObject.Text
>in ComboBox.RowSource property but I get error message that Thisform can be used only in methods.
>
>How to solve this?

One way is to use a custom form method to create a cursor for the ComboBox, and then set the ComboBox.RowSource:
* ComboBox.Init( )
DODEFAULT( )

ThisForm.ComboBoxRowSourceSet( This, ThisForm.MyObject.Text )

* Form.ComboBoxRowSourceSet
LPARAMETERS loComboBox, lcText

SELECT SomeColumn FROM MyTable WHERE MyField == lcText INTO CURSOR SomeCursor

WITH loComboBox
  .RowSourceType = 2
  .RowSource = "SomeCursor"

  .Value = SomeCursor.SomeColumn
  .Refresh( )
  * ComboBoxes are tricky, you may need to play around with setting various properties
  * to get it initialized the way you want

ENDWITH
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform