Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ComboBox / setting a default .value
Message
 
À
19/09/2002 12:14:26
John Vlahos
V I Software Solutions Design
Mississauga, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00702313
Message ID:
00702416
Vues:
17
If the ControlSource for the combo is set, and the value exists in the dropdown, then it will display the value. What's different about combos is that the value you store is usually a foreign key, and the value you display is a name or description from a lookup table. If that's your situation, then you need to set the BoundColumn to the column with the Key (which doesn't have to be displayed in the dropdown). If that key is numeric, you must also set the BoundTo property to .T.

If the combo doesn't have a controlsource, and you want to initialize it to something, you can set the ListIndex property to the item in the dropdown that should be selected.

>I am trying to set a combobox.value to a value which is looked up and returned from another table. I would like it to be displayed on the screen automatically, instead of it being empty.
>
>For example, in the Sales Order file I have a field named "cBillToID".
>Upon loading any sale order (previously entered), I would like to lookup that "cBillToid" field in the "CUSTOMER_BILLTO" table and return and display the returned "cCode" in the combobox (value) named "cboBillToCode" on the saleorder form.
>
>My problem is that upon loading any sales order my combo box (default value) is empty.
>
>I attempt the same thing to return the "cName" into a text field on the Sales Order form it works great. Is there a diffence with "text" fields and "combo" boxes in storing a value?
>
>I am not talking about the actuall drop down list. That is fine. That is a SELECT from the CUSTOMER_BILLTO table. That works ok.
>
>Following is my code from within the Sales Order form.
>============================================================================
>LOCAL llSkipSeek
>WITH THISFORM.pgfData.pgEntry
>
>llSkipSeek =THIS.oCurrentData.EOF() OR ( THIS.oCurrentData.TableIsEmpty() ) OR THIS.oCurrentData._lAddMode
>
>IF NOT llSkipSeek
> =SEEK(THIS.oCurrentdata.FieldGetValue("cBillToID"), "CUSTOMER_BILLTO")
>ENDIF
>
>.txtcBillToName.Value= IIF(NOT llSkipSeek, CUSTOMER_BILLTO.cName, SPACE(LEN(CUSTOMER_BILLTO.cName)))
>.cboBillToCode.Value= IIF(NOT llSkipSeek, CUSTOMER_BILLTO.cCode, SPACE(LEN(CUSTOMER_BILLTO.cCode)))
>
>ENDWITH
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform