Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binding a Combo programatically
Message
 
À
21/03/2002 00:05:11
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00635187
Message ID:
00635461
Vues:
14
>>>>>Hi All:
>>>>>
>>>>>I have two combos on Page2 of a pageframe. They are populated (Labtests) in the Load method of the form using a select statement.
>>>>>
>>>>>In one of the pages, the user may enter a new code and test name (in text field) which are then inserted into the Labtests table. when this happens, I would like the two combos to contain a refreshed verision of the labtests table, i.e., the should include the newly inserted test. I have the code to insert the new code and name in the Save button.
>>>>>
>>>>>Any suggestion? TIA
>>>>>
>>>>>- Ravi
>>>>
>>>>Typically, if you want to refresh the combo or listbox content you issue:
>>>>
>>>>combo.Requery()
>>>>combo.Refresh()
>>>
>>>Hi Nick:
>>>
>>>Thank you for your reponse. I included the requery() and refresh() in the save button, while saving the new entries. regardless, when I went back to the combo to see if the new entry was there, I did not see it. when I closed the form and fired it again, the new entry was in the combo. So how should I handle this? TIA.
>>>
>>>Ravi
>>
>>How exactly you did set up the combo? Could you show your code from Load method?
>
>This is what I have in the load method:
>
*Get data to populate combo2 in page2 - Lab test codes
>select * from labtests into cursor LabTestInfo order by testcode, testname
>
>>The combo supposed to have combo.RowSourcetype = 3 - SQL statement and combo.RowSource = [your SQL statement here]
>
>I set the properties as follows:
>
ControlSource = mLabTestCode
>RowSource = LabTestInfo.testcode
>RowSourceType = 2-Alias
>
>In the Save button I have the same select statement as above, but the newly entered data does not show up in the combo after clicking Save. It does if I fire the form up again.
>
>TIA.
>
>- Ravi

This should work fine with
combo.Requery()
combo.Refresh()
if you set
combo.RowSourcetype = 3
combo.RowSource = "select * from labtests into cursor LabTestInfo order by testcode, testname" && you don't need quotes if you enter it in Property sheet.
Or you can make it as Dragan says. But really you don't have to have a special method to fill the combo as your case looks like the standard usage for combo.RowSourcetype = 3 - Select statement.
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