Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help ! Create Grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00350518
Message ID:
00350534
Vues:
23
>sorry it is my first time to write a program.I have this problem.
>In form i have a combo box, text box & button
>i want select "combo box" item & in text box input a number after that press a button to show i select item & number in the grid box.
>how to i write a code in a button. but i need to update the table record.How can i do it!
>Thank You Very Much.

Hi Cavin,

The best way would be to use a parameterized view as a source of your grid. Say, in combobox we select some category, and in a textbox- invoice number. The view SQL then could look like

SELECT * from myTable ;
WHERE mytable.category = lcCategory ;
AND mytable.invnumber = lnNumber ;

You set up the view in form Dataenvironment with NoDataOnLoad = .t. so it does not fill the view with data when you load the form. You also make your view updatable and make it Recordsource for your grid. Then in your button.Click() you put the code like:

lcCategory = this.parent.cboCategory.Value
lnNumber = this.parent.txtNumber.Value
=REQUERY("myView")
this.parent.myGrid.Refresh()

You should also issue Tableupdate() for your view when you need it to send teh updates to the table.

HTH,

Nick
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
Répondre
Fil
Voir

Click here to load this message in the networking platform