Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to redisplay non-list combobox value?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00477162
Message ID:
00477250
Vues:
28
>I have a combobox (style=0) that has rowsource=6, rowsource=product.cproddesc,
>controlsource=ordline.cprodesc. This allows the user to override the
>product description and type one in if needed. When I go back to this
>order the description they entered is not displayed in the combobox.
>How can I make it show?

Basically, if you type the new value in combo which is not in your lookup table (product) you need to add the record with this value into it. You can do it in combo.Value method. You need to compare the combo.Value and .DisplayValue properties. If they are not the same it means the value you typed is not in lookup table. Or, you can check if combo.Listindex = 0, which means the same.
So, the code in combo.Valid() method may look like this:
   IF this.Listindex = 0 AND !EMPTY(this.DisplayValue) && you typed something but it is not in the lookup table
      INSERT INTO product (cproddesc) VALUES (this.DisplayValue)
      this.Requery() && re-read the combo.rowsource so the new value is added to the items list.
      this.Refresh()
   ENDIF
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform